<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Perl language syntax highlighting troubles (bug or limitation ?)]]></title><description><![CDATA[<p dir="auto">Good evening to all,</p>
<p dir="auto">I use mainly n++ to edit perl files. It works well for most of perl syntax but I have some trouble when using the following per built-in functions/statements in my code:</p>
<ul>
<li>
<p dir="auto">all the q* perl functions (qx, qw, qr…) are not highlighted as perl keywords in my code, while being declared in the “keywords” list in the perl “Syntax Highlighting” syntax configuration tab.[link text]</p>
</li>
<li>
<p dir="auto">The ‘&lt;&lt;’ operator/modifier in a print statement to produce HERE-DOCS as in Unixes-like shells (Korn, bash) is not highlighted neither as an operator nor a punctuation. The Here-doc text itself is highlighted as ‘default’ and not as “text” nor as “longquote” or anything else that could be relevent.</p>
</li>
</ul>
<p dir="auto">Is someone having an idea of what could be the problem (perhaps an underlying Scintilla restriction/bug on Perl syntaxing) and how could it be fixed or circumvented / got around ?</p>
<p dir="auto">Thank you in advance for your help.</p>
<p dir="auto">By the way, I would like to tell the author: “what a nice job and thank you to let us use a so nice piece of code for our needs and our pleasure!”.</p>
<p dir="auto">Gilles</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/17283/perl-language-syntax-highlighting-troubles-bug-or-limitation</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 09:39:58 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/17283.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Mar 2019 23:23:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Sun, 16 Aug 2020 17:34:12 GMT]]></title><description><![CDATA[<p dir="auto">For those being directed here by other links from the forum, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a> has a newer version available at his <a href="https://github.com/Ekopalypse/NppPythonScripts/blob/master/npp/EnhanceAnyLexer.py" rel="nofollow ugc">github, here</a>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/56872</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/56872</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sun, 16 Aug 2020 17:34:12 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Wed, 27 Mar 2019 17:14:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14711">@Gilles-Maisonneuve</a></p>
<p dir="auto">I’ve played with that for nearly two days and it seems to work.<br />
Folding with ~10000 lines within the visible area seems to work without<br />
any noticeable delay but a test with 20000 lines revealed already its weakness.</p>
<p dir="auto">The issue about having multiple lines colored is still open, the workaround<br />
extends the visible area by 15 lines. If this should be changed, then you have to<br />
change this line <code>self.offset_line = 15  # hack - see style function for more info</code><br />
But be warned, the performance of the script comes from the fact that it tries to color<br />
only the visible area every time an updateui event is fired and not by styling<br />
the whole script every time.</p>
<p dir="auto">The following should be copied into a script, let’s call it <code>EnhanceAnyBuiltinLexer.py</code></p>
<pre><code># -*- coding: utf-8 -*-
from Npp import editor, editor1, editor2, notepad, NOTIFICATION, SCINTILLANOTIFICATION, INDICATORSTYLE, INDICFLAG
from collections import OrderedDict
from itertools import groupby, count

SC_INDICVALUEBIT = 0x1000000


class SingletonEnhanceLexer(type):
        '''
            Ensures, more or less, that only one
            instance of the main class can be instantiated
        '''

        _instance = None

        def __call__(cls, *args, **kwargs):
            if cls._instance is None:
                cls._instance = super(SingletonEnhanceLexer, cls).__call__(*args, **kwargs)
            return cls._instance


class EnhanceLexer(object):
    '''
        Provides additional color options and should be used
        in conjunction with the built-in lexers.
        An indicator is used to avoid style collisions.
        Although the Scintilla documentation states that indicators 0-7 are
        reserved for the lexers, indicator 0 is used because none of the
        builtin lexers uses it internally.
        Actually, it looks like python lexer is the only lexer at all
        which uses an idicator and its value is 1

        Even when using more than one regex, it is not necessary
        to define more than one indicator because the class uses
        the flag SC_INDICFLAG_VALUEFORE.
        See https://www.scintilla.org/ScintillaDoc.html#Indicators
        for more information on that topic
    '''
    __metaclass__ = SingletonEnhanceLexer

    def __init__(self):
        '''
            Instantiates the class, defines global indicator settings,
            registers callbacks and initializes needed variables.
            Because of __metaclass__ = ... usage, is called once only.
        '''
        editor1.indicSetStyle(0, INDICATORSTYLE.TEXTFORE)
        editor1.indicSetFlags(0, INDICFLAG.VALUEFORE)
        editor2.indicSetStyle(0, INDICATORSTYLE.TEXTFORE)
        editor2.indicSetFlags(0, INDICFLAG.VALUEFORE)
        editor.callbackSync(self.on_updateui, [SCINTILLANOTIFICATION.UPDATEUI])
        editor.callbackSync(self.on_marginclick, [SCINTILLANOTIFICATION.MARGINCLICK])
        notepad.callback(self.on_langchanged, [NOTIFICATION.LANGCHANGED])
        notepad.callback(self.on_bufferactivated, [NOTIFICATION.BUFFERACTIVATED])
        self.INDICATOR_ID = 0
        self.registered_lexers = dict()
        self.doc_is_of_interest = False
        self.lexer_name = ''
        self.regexes = OrderedDict()
        self.excluded_styles = []
        self.offset_line = 15  # hack - see style function for more info


    def register_lexer(self, lexer_name, _regexes, excluded_styles):
        '''

            reformat provided regexes and cache everything
            within registered_lexers dictionary.

            Args:
                lexer_name = string, expected values as returned by editor.getLexerLanguage()
                _regexes = OrderedDict either in form of
                           _regexes[(int, int)] = (r'', [int]) or
                           _regexes[(int, (r, g, b))] = (r'', [int])
                excluded_styles = list of integers
            Returns:
                None
        '''
        self.lexer_name = lexer_name.lower()
        for k, v in _regexes.items():
            if isinstance(k[1], tuple):
                fg_color = k[1]
            else:
                fg_color = editor.styleGetFore(k[1])

            self.regexes[(k[0], self.rgb(*fg_color) | SC_INDICVALUEBIT)] = v

        self.registered_lexers[self.lexer_name] = (self.regexes, excluded_styles)


    def check_lexer(self):
        '''
            Checks if the current document is of interest.
            If it is, loads the cached regexes and exclusion list.
            Sets the document flag accordingly

            Args:
                None
            Returns:
                None
        '''
        self.lexer_name = editor.getLexerLanguage().lower()
        if self.lexer_name in self.registered_lexers:
            self.regexes, self.excluded_styles = self.registered_lexers[self.lexer_name]
            self.doc_is_of_interest = True
        else:
            self.doc_is_of_interest = False


    @staticmethod
    def rgb(r, g, b):
        '''
            Helper function
            Retrieves rgb color triple and converts it
            into its integer representation

            Args:
                r = integer, red color value in range of 0-255
                g = integer, green color value in range of 0-255
                b = integer, blue color value in range of 0-255
            Returns:
                integer
        '''
        return (b &lt;&lt; 16) + (g &lt;&lt; 8) + r


    def paint_it(self, color, matchgroups, match):
        '''
            This is where the actual coloring takes place.
            Color, matchgroups and match object must be provided.
            Matchgroups define which group(s) is(are) of interest
            Coloring occurs only if the position is not within the excluded range.

            Args:
                color = integer, expected in range of 0-16777215
                matchgroups = list of integers
                match = python re.match object
            Returns:
                None
        '''
        for group in matchgroups:
            start_pos = match.span(group)[0]

            if start_pos &lt; 0 or editor.getStyleAt(start_pos) in self.excluded_styles:
                continue

            editor.setIndicatorCurrent(self.INDICATOR_ID)
            editor.setIndicatorValue(color)
            editor.indicatorFillRange(start_pos, match.span(group)[1] - start_pos)


    def style(self):
        '''
            Calculates the text area to be searched for in the current document.
            Deletes the old indicators before setting new ones, searches for
            the defined regexes and calls colorize function on match.

            Args:
                None
            Returns:
                None
        '''
        # TODO:
        # In cases where it is needed to color multiple lines there is a glitch
        # which affects coloring, if either start or end of that text is not visible.
        # Current workaround extends the visible area by self.offset_line lines,
        # which obviously won't work if more than self.offset_line lines need to be colored.
        # Need to find a better way to make sure that those parts do get colored as well.
        #
        # Maybe doing some kind of background caching and recalculate
        # only when there are changes in the document?

        start_line = editor.docLineFromVisible(editor.getFirstVisibleLine())
        end_line = editor.docLineFromVisible(start_line + editor.linesOnScreen())

        start_line -= self.offset_line if start_line &gt; self.offset_line else 0

        max_line = editor.getLineCount()
        if editor.getWrapMode():
            end_line = sum([editor.wrapCount(x) for x in range(end_line)])

        end_line += self.offset_line if max_line - self.offset_line &gt; end_line else max_line

        if editor.getAllLinesVisible():
            groups = [(start_line, end_line)]
        else:
            visible_lines = [x for x in range(start_line, end_line) if editor.getLineVisible(x)]
            groups = [tuple(x) for _, x in groupby(visible_lines, key=lambda n, c=count(): n - next(c))]

        editor.setIndicatorCurrent(self.INDICATOR_ID)
        editor.indicatorClearRange(0, editor.getTextLength())

        for group in groups:
            start_position = editor.positionFromLine(group[0])
            end_position = editor.getLineEndPosition(group[-1])

            for color, regex in self.regexes.items():
                editor.research(regex[0],
                                lambda match: self.paint_it(color[1],
                                                            regex[1],
                                                            match),
                                0,
                                start_position,
                                end_position)


    def on_bufferactivated(self, args):
        '''
            Callback which gets called every time one switches a document.
            Triggers the check if the document is of interest.

            Args:
                provided by notepad object but none are of interest
            Returns:
                None
        '''
        self.check_lexer()


    def on_updateui(self, args):
        '''
            Callback which gets called every time scintilla
            (aka the editor) changed something within the document.

            Triggers the styling function if the document is of interest.

            Args:
                provided by scintilla but none are of interest
            Returns:
                None
        '''
        if self.doc_is_of_interest:
            self.style()


    def on_langchanged(self, args):
        '''
            Callback gets called every time one uses the Language menu to set a lexer
            Triggers the check if the document is of interest

            Args:
                provided by notepad object but none are of interest
            Returns:
                None
        '''
        self.check_lexer()


    def on_marginclick(self, args):
        '''
            Callback which gets called every time one clicks into the margin columns.
            margin 2 is the one of interest

            Triggers the styling function if the document is of interest.

            Args:
                margin returns an integer of the currently used column
            Returns:
                None
        '''
        if args['margin'] == 2 and self.doc_is_of_interest:
            self.style()


    def main(self):
        '''
            Main function entry point.
            Simulates two events to enforce detection of current document
            and potential styling.

            Args:
                None
            Returns:
                None
        '''
        self.on_bufferactivated(None)
        self.on_updateui(None)
</code></pre>
<p dir="auto">Then, within either the user <a href="http://startup.py" rel="nofollow ugc">startup.py</a> or any other new script the following should be<br />
copied into.<br />
Note, I haven’t updated the perl regexes so those might not be the one you want to use.</p>
<pre><code># -*- coding: utf-8 -*-
from collections import OrderedDict
import EnhanceAnyBuiltinLexer
enhance_lexer = EnhanceAnyBuiltinLexer.EnhanceLexer()

# perl definitions starts
regexes = OrderedDict()
regexes[(1, 5)] = (r'\bq[rwqx]{0,1}\b([^\h]).*?\1|(\bq[rwqx]{0,1}\b\h+(\w).*?\3)', [0])
regexes[(2, 5)] = (r'(?s)\bq[rwqx]{0,1}\b\h*(\(.+?\)|\[.+?\]|\{.+?\})', [0])
regexes[(3, (255,0,0))] = (r'(?s)(\s*(&lt;&lt;)\s*("{0,1}.+"{0,1})\s*;.*?\3)', [0])
excluded_styles = [1, 2]
enhance_lexer.register_lexer('perl', regexes, excluded_styles)
# perl definitions ends


# python definitions starts
regexes = OrderedDict()
regexes[(0, (224, 108, 117))] = (u'\\b(cls|self)\\b', [0])
regexes[(1, (209, 154, 102))] = (u'(?:(?:def)\s\w+)\s*\((.+)\):', [1])
regexes[(2, (86, 182, 194))]  = (u'(\*|\*\*)(?=\w)', [0])
regexes[(3, (79, 175, 239))]  = (u'class\s*\w+?(?=\()|def\s*\w+?(?=\()|(\w+?(?=\())', [1])
regexes[(4, (86, 182, 194))]  = (u'\\b(editor|editor1|editor2|notepad|console|__init__|__call__|__del__|super|object|type|print)\\b', [0])
excluded_styles = [1, 3, 4, 6, 7, 12]
enhance_lexer.register_lexer('python', regexes, excluded_styles)
# python definitions ends

# 
# put additional definitions for other lexers here
#

# should be last statement
# first current document doesn't trigger bufferactivated 
# therefore call main to simulate it
enhance_lexer.main()
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/41661</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41661</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Wed, 27 Mar 2019 17:14:03 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Tue, 26 Mar 2019 18:27:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a></p>
<p dir="auto">thank you very much for your insight, very much appreciated.</p>
<blockquote>
<p dir="auto">Obviously the problem with that is that it could take a great deal of time.</p>
</blockquote>
<p dir="auto">Right, I tested with a 5000 lines of code script and there was a noticeable delay.</p>
<blockquote>
<p dir="auto">In keeping with your current approach, have you considered what happens when lines are folded or hidden?</p>
</blockquote>
<p dir="auto">Yes, I’ve tested different scenarios when upper part has folded/hidden text or<br />
within current visible area and bottom but neither of those are re-calculated,<br />
so, you are right - this can become another issue.<br />
What if hundreds of lines are folded but within the calculated range?<br />
Need to test this more thoroughly.</p>
<blockquote>
<p dir="auto">Pythonscript/Scintilla has editor.docLineFromVisible()</p>
</blockquote>
<p dir="auto">:-D yes, - looks like the first two lines of the example :-)</p>
<p dir="auto">Again, thank you very much.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41606</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41606</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Tue, 26 Mar 2019 18:27:51 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Tue, 26 Mar 2019 12:43:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a></p>
<p dir="auto">You have a good approach, I think. The only really great solution, that is great in one way and bad in another, is to lex over the entire document constantly. Obviously the problem with that is that it could take a great deal of time.</p>
<p dir="auto">In keeping with your current approach, have you considered what happens when lines are folded or hidden? It seems that this would alter how far you need to “reach” beyond the current line (in both directions).</p>
<p dir="auto">Pythonscript/Scintilla has <code>editor.docLineFromVisible()</code> which may be of some use for this situation.  Notepad++ itself uses it as well, see <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp#L83-L104" rel="nofollow ugc">https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp#L83-L104</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/41593</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41593</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 26 Mar 2019 12:43:08 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Mon, 25 Mar 2019 23:46:03 GMT]]></title><description><![CDATA[<p dir="auto">I’m testing the EnhanceAnyBuiltinLexer right now and I noticed a situation where I don’t know exactly how to solve it better.<br />
The issue is the following.<br />
Assume that the text, which should get colored, are multiple lines. When the start or the end of that text is not within the visible area then the whole text is not colored.<br />
I assume that is what <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> was mentioning.<br />
:-(<br />
To avoid this I use a sliding window approach (term borrowed from networks :-), which means as long as the first visible line is not greater than 15 the algorithm starts from line 0 and afterwards it is current line minus 15. Similar the end line gets added 15 unless the maximum lines would be reached.</p>
<p dir="auto">Not nice, but works as long as there is no text, which should be colored, contains more than 15 lines.</p>
<p dir="auto">Any ideas how I could solve it differently?</p>
<p dir="auto">Here the current code - maybe this makes it easier to understand what I’m trying to solve.</p>
<pre><code>        start_line = editor.docLineFromVisible(editor.getFirstVisibleLine())
        end_line = editor.docLineFromVisible(start_line + editor.linesOnScreen())

        start_line -= 15 if start_line &gt; 15 else 0

        max_line = editor.getLineCount()
        if editor.getWrapMode():
            end_line = sum([editor.wrapCount(x) for x in range(end_line)])
        end_line += 15 if max_line - 15 &gt; end_line else max_line

        start_position = editor.positionFromLine(start_line)
        end_position = editor.getLineEndPosition(end_line)

        editor.setIndicatorCurrent(self.INDICATOR_ID)
        editor.indicatorClearRange(0, editor.getTextLength())
        for color, regex in self.regexes.items():
            editor.research(regex[0],
                            lambda match: self.paint_it(color[1],
                                                        regex[1],
                                                        match),
                            0,
                            start_position,
                            end_position)
</code></pre>
<p dir="auto">Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41585</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41585</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Mon, 25 Mar 2019 23:46:03 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Tue, 26 Mar 2019 18:20:50 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14711">@gilles-maisonneuve</a>,</p>
<p dir="auto">If you decide to use <strong><code>\h*</code></strong>, instead of <strong><code>\h+</code></strong>, in regex <strong><code>#4</code></strong>, then, some configurations can be found, <strong>either</strong>, with the regexes <strong><code>#3</code></strong> and <strong><code>#4</code></strong> ! So, to be rigorous, you could use, other regexes, which define <strong>two disjoint</strong> sets :</p>
<ul>
<li>
<p dir="auto"><strong>Here-doc</strong> documents, with TEXT, <strong>right after</strong> the <strong><code>&lt;&lt;</code></strong> operator ( regex <strong><code>#3</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong>Here-doc</strong> documents, with TEXT, <strong>after</strong> the <strong><code>&lt;&lt;</code></strong> operator and possible <strong>space</strong> chars and a <strong>mandatory</strong> delimiter <strong><code>'</code></strong> or <strong><code>'</code></strong> ( regex <strong><code>#4</code></strong> )</p>
</li>
</ul>
<p dir="auto">So, in the <strong>Python</strong> script :</p>
<pre><code class="language-py"># Color every "here-document" with the USER color r = 255 g = 0 b = 255 ( =&gt; Magenta )
regexes[(3, (255,0,255))] = (r'(?s-i)(&lt;&lt;)(\w+)\h*;.*?\2', [1])
regexes[(4, (255,0,255))] = (r'(?s-i)(&lt;&lt;)\h*(\x27|")(?|(\w+)\\?([\x27"]\w+)|(\w+)())\2\h*;.*?\3\4', [1,3,4])
</code></pre>
<p dir="auto">Tested, with <strong>success</strong>, against the <strong>Perl</strong> file “<strong><code>Test_2_Gilles.pl</code></strong>”, recapitulating <strong>all</strong> cases, below :</p>
<pre><code class="language-diff">#----- NO SPACE nor " nor ', AFTER &lt;&lt; ----- Colored with Regex #3 -----

$x=&lt;&lt;TEXT;
Plain text here
TEXT

$x=&lt;&lt;TEXT;
Plain text here
TEXT

#----- DELIMITER " or ', AFTER &lt;&lt; ----- Colored with Regex #4 -----

$x=&lt;&lt;"TEXT";
Plain text here
TEXT

$x=&lt;&lt;'TE"XT' ;
Plain text here
TE"XT

$x=&lt;&lt;"TE'XT" ;
Plain text here
TE'XT

$x=&lt;&lt;'TE\'XT';
Plain text here
TE'XT

$x=&lt;&lt;"TE\"XT";
Plain text here
TE"XT

#----- SPACE(S) + DELIMITER " or ', AFTER &lt;&lt; ----- Colored with Regex #4 -----

$x=&lt;&lt; 'TEXT';
Plain text here
TEXT

$x=&lt;&lt; "TEXT";
Plain text here
TEXT

$x=&lt;&lt; 'TE"XT';
Plain text here
TE"XT

$x=&lt;&lt; "TE'XT";
Plain text here
TE'XT

$x=&lt;&lt; 'TE\'XT';
Plain text here
TE'XT

$x=&lt;&lt; "TE\"XT";
Plain text here
TE"XT

#------------------------- END --------------------------
</code></pre>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41551</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41551</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 26 Mar 2019 18:20:50 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Sun, 24 Mar 2019 13:51:22 GMT]]></title><description><![CDATA[<p dir="auto">Changed the regexp from:<br />
<code>regexes[(1, (128,0,128))] = (r'(?s)\bq[rwqx]{0,1}\b([^\h]).*?\1|(\bq[rwqx]{0,1}\b\h+(\w).*?\3)', [0])</code><br />
to:<br />
<code>..........................................................vv</code><br />
<code>regexes[(1, (128,0,128))] = (r'(?s)\bq[rwqx]{0,1}\b([^\h])\b.*?\1|(\bq[rwqx]{0,1}\b\h+(\w).*?\3)', [0])</code></p>
<p dir="auto">so that</p>
<pre><code>qw( my words here
       are colored but not the remaing text after
       the closing parenthese, until it finds another one...);
</code></pre>
<p dir="auto">Without the word boundary when I used <code>"qw("</code> instead of <code>"qw ("</code> I got the coloring extending past the closing <code>)</code> (respectively <code>{...}</code>, <code>[..]</code>, etc.)</p>
<p dir="auto">I know that this regex does not fit the full Perl syntax capability (any char separator like in <code>@array = qw xfoo bar quux;</code> -&gt; <code>@array = ('foo','bar','quu');</code>) but I only use common separators like <code>/{[()]}/</code>. I leave it to someone else to figure this out…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41548</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41548</guid><dc:creator><![CDATA[Gilles Maisonneuve]]></dc:creator><pubDate>Sun, 24 Mar 2019 13:51:22 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Sun, 24 Mar 2019 13:01:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a></p>
<p dir="auto">Hello Eren,</p>
<p dir="auto">Worked like a charm (the <code>(?s)</code> syntax), thank you.</p>
<p dir="auto">About the multiple language script… well I did not get your point exactly beside the fact that it is a lot more tricky than I thought. So, lazy as I am to learn Python, I’ll wait for you to find a solution to put in your <a href="http://EnhancePerlLexer.py" rel="nofollow ugc">EnhancePerlLexer.py</a> (which then would become <a href="http://EnhanceAnyLexer.py" rel="nofollow ugc">EnhanceAnyLexer.py</a>).</p>
<p dir="auto">Whenever you have time…</p>
<p dir="auto">Thanks for all.</p>
<p dir="auto">Gilles</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41546</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41546</guid><dc:creator><![CDATA[Gilles Maisonneuve]]></dc:creator><pubDate>Sun, 24 Mar 2019 13:01:43 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Sun, 24 Mar 2019 12:09:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14711">@Gilles-Maisonneuve</a></p>
<p dir="auto">Hello Gilles,</p>
<p dir="auto">how about using the single-line modifier <code>(?s)</code> in front of the regex?<br />
<code>r'(?s)\bq[rwqx]{0,1}\b\h*(\(.+?\)|\[.+?\]|\{.+?\})'</code></p>
<p dir="auto">This should do the job, I assume.</p>
<p dir="auto">Concerning the idea of using the script for multiple languages at the same time.<br />
Currently the issue is that a second script would overwrite the variables<br />
like <code>regexes</code>, <code>BUILTIN_LEXER</code>, <code>EnhanceBuiltinLexer</code> etc… which would break<br />
the logic of the first script.<br />
My first thought would be ensuring namespace integrity, which means the script<br />
needs to get modified in a way that no code gets be executed while importing the script. Which then would result in something like<br />
<code>import EnhancePerlLexer</code> to import the script and an additional<br />
<code>EnhancePerlLexer.start()</code> to activate it. Other scripts would then be configured like</p>
<p dir="auto"><code>import EnhanceCmdLexer</code> and <code>EnhanceCmdLexer.start()</code> etc…</p>
<p dir="auto">Another way would be to make a base class and overwrite it … hmm… need to think about it. Will try to find a way which is reasonable and easy to adapt.<br />
Will keep you informed.</p>
<p dir="auto">Have a nice Sunday and greetings<br />
Eren</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41541</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41541</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Sun, 24 Mar 2019 12:09:11 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Sun, 24 Mar 2019 01:45:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a></p>
<p dir="auto">Hello Eko,</p>
<p dir="auto">I met the following shortcoming with the q* coloring:<br />
<code>use subs qw(divide_by_hand resultline is_fine_resultline resultline_len fine_resultline_len);</code><br />
works fine, but if I want to split my qw() in 2 lines (because is becoming to be too long on the right side of screen), then I do:</p>
<pre><code>use subs qw(divide_by_hand resultline is_fine_resultline
            resultline_len fine_resultline_len);
</code></pre>
<p dir="auto">and I loose the coloring.</p>
<p dir="auto">Could it be possible with python to include CRLF/NL (\n) in the pattern so that I can fold my qw (and even my other q*) statements ?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41538</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41538</guid><dc:creator><![CDATA[Gilles Maisonneuve]]></dc:creator><pubDate>Sun, 24 Mar 2019 01:45:40 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Fri, 22 Mar 2019 08:49:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a><br />
Thanks.<br />
I picked your 4th regex with END of here doc coloring included.<br />
Just changed once again the \h+ in \h* to allow for no space between previous keyword or variable and the ‘&lt;&lt;’ operator.</p>
<p dir="auto">I think I’m going to use the regexp and python scripts provided in this thread to enhanced other syntax hilighting (I think about CMD and Yori for example. It’ll make me progress in Python, now that I have tested and tasted it.</p>
<p dir="auto">Thanks to all again.</p>
<p dir="auto">Gilles</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41500</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41500</guid><dc:creator><![CDATA[Gilles Maisonneuve]]></dc:creator><pubDate>Fri, 22 Mar 2019 08:49:49 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Fri, 22 Mar 2019 19:35:43 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14711">@gilles-maisonneuve</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/13724">@eko-palypse</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/9520">@meta-chuh</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@alan-kilborn</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@peterjones</a> and <strong>All</strong>,</p>
<p dir="auto">Ah ! So I’m going to do the <strong><code>101th</code></strong> post ;-)) Don’t worry, I won’t be [too] <strong>long</strong> ! I will :</p>
<ul>
<li>
<p dir="auto">Explain why my <strong>previous</strong> regexes did <strong>not</strong> work ( almost obvious )</p>
</li>
<li>
<p dir="auto">Give you a <strong>new</strong> version of <strong>all</strong> the regexes, used in the <strong>EkoPalypse</strong> script, which :</p>
<ul>
<li>
<p dir="auto">Matches the case <strong><code>qq|qr|qw|qx|q</code></strong> with the <strong><code>&lt;</code></strong> and <strong><code>&gt;</code></strong> delimiters</p>
</li>
<li>
<p dir="auto">Matches the case of <strong>here-docs</strong>, containing an <strong>escaped</strong> delimiter ( <strong><code>\'</code></strong> or <strong><code>\"</code></strong> ), inside the <strong>starting</strong> and <strong>ending</strong> blocks ( <strong>legal</strong> syntax )</p>
</li>
</ul>
</li>
</ul>
<p dir="auto">For information, refer to :</p>
<p dir="auto"><a href="https://perldoc.perl.org/perlop.html" rel="nofollow ugc">https://perldoc.perl.org/perlop.html</a></p>
<p dir="auto">And particularly :</p>
<p dir="auto"><a href="https://perldoc.perl.org/perlop.html#Quote-Like-Operators" rel="nofollow ugc">https://perldoc.perl.org/perlop.html#Quote-Like-Operators</a></p>
<p dir="auto"><a href="https://perldoc.perl.org/perlop.html#Quote-and-Quote-like-Operators" rel="nofollow ugc">https://perldoc.perl.org/perlop.html#Quote-and-Quote-like-Operators</a></p>
<hr />
<p dir="auto">So, <strong>Gilles</strong>, in my <strong>previous</strong> regexes, I used the single <strong>quote</strong> symbol as it ! At that moment I just tested the <strong>regular</strong> expressions, <strong>without</strong> using the <strong>Python</strong> script :-((</p>
<p dir="auto">Once I decided to use the <strong>Eko</strong>’s script, I quickly understood that the <strong>single quote</strong> symbol is, first, interpreted by the <strong>Python</strong> engine. So, when I changed any <strong><code>'</code></strong> single <strong>quote</strong> with the syntax <strong><code>\x27</code></strong>, in my <strong>previous</strong> regexes, everything went <strong>OK</strong> ;-))</p>
<hr />
<p dir="auto">Then, I decided to test the <strong><code>m</code></strong> <strong>Perl</strong> instruction, first, with <strong>all</strong> possible delimiters ( See my <strong><code>.pl</code></strong> test file, below )</p>
<p dir="auto">For instance :</p>
<pre><code class="language-pl">m bPATTERNb
m ZPATTERNZ
m 0PATTERN0
m _PATTERN_
m(PATTERN)
m&lt;PATTERN&gt;
m [PATTERN]
m {PATTERN}
m!PATTERN!
m"PATTERN"
m/PATTERN/
m $PATTERN$
m %PATTERN%
m &amp;PATTERN&amp;
....
....
</code></pre>
<p dir="auto">On the same way, I tried <strong>all</strong> syntaxes of the PERL instruction <strong><code>qr</code>Delimiter<code>PATTERN</code>Delimiter</strong> So, in regex <strong><code>#1</code></strong>, relative to the <strong><code>q</code></strong> PERL instructions, I <strong>enumerated all</strong> possible delimiters, <strong>different</strong> from a <strong>word</strong> char and from the <strong>four</strong> sets <strong><code>() [] {} &lt;&gt;</code></strong>, in the <strong>character class</strong> <strong><code>[!"#$%&amp;\x27*+,./:;=?@``|~\\^-]</code></strong></p>
<p dir="auto">Note that in that regex <strong><code>#1</code></strong>, I used the <strong>special</strong> syntax <strong><code>(?|........|.......|...     ....|....)</code></strong>, which forces the <strong>renumbering</strong> of the groups, located <strong>inside</strong> the group, for <strong>each alternative</strong> ! ( See an <strong>example</strong>, at the <strong>end</strong> of that post )</p>
<p dir="auto">Then, I tried to <strong>enumerate all</strong> the variations of the <strong>here-docs</strong> syntax, including <strong>special</strong> cases as, for instance</p>
<pre><code class="language-pl">$x=&lt;&lt; "TE\"XT";
Plain text here
TE"XT
</code></pre>
<p dir="auto">And I <strong>succeeded</strong> to manage this case in my <strong>new</strong> regexes <strong><code>#3</code></strong> and <strong><code>#4</code></strong> ;-))</p>
<p dir="auto">However, note that the <strong>highlighting</strong> of any <strong>here-document</strong> is effective ONLY IF the <strong><code>ending</code></strong> text is visible, in the <strong>current</strong> editor window !</p>
<hr />
<p dir="auto">So, here are my <strong>new</strong> regexes :</p>
<pre><code class="language-py"># Color every instruction word qq|qr|qw|qx|q with PERL Style 5 ( r = 0 v = 0 b = 255 =&gt; Blue )

regexes[(1, 5)] = (r'(?s-i)\bq[qrwx]?(?|\h*([!"#$%&amp;\x27*+,./:;=?@`|~\\^-])|\h+(\w)).*?\1', [0])
regexes[(2, 5)] = (r'(?s-i)\bq[qrwx]?\h*(\(.+?\)|\[.+?\]|\{.+?\}|&lt;.+?&gt;)', [0])

# Color every here-document with the USER color r = 255 g = 0 b = 255 ( =&gt; Magenta )

regexes[(3, (255,0,255))] = (r'(?s-i)(&lt;&lt;)([\x27"]?)(?|(\w+)\\([\x27"]\w+)|(\w+)())\2\h*;.*?\3\4', [1])
regexes[(4, (255,0,255))] = (r'(?s-i)(&lt;&lt;)\h+(\x27|")(?|(\w+)\\([\x27"]\w+)|(\w+)())\2\h*;.*?\3\4', [1,3,4])

# If, on addition, you want to highlight the END of here-docs :

#regexes[(3, (255,0,255))] = (r'(?s-i)(&lt;&lt;)([\x27"]?)(?|(\w+)\\([\x27"]\w+)|(\w+)())\2\h*;.*?(\3)(\4)', [1,5,6])
#regexes[(4, (255,0,255))] = (r'(?s-i)(&lt;&lt;)\h+(\x27|")(?|(\w+)\\([\x27"]\w+)|(\w+)())\2\h*;.*?(\3)(\4)', [1,3,4,5,6])
</code></pre>
<p dir="auto">If you want to know <strong>how</strong> these regexes work, I could give you some <strong>hints</strong>, next time. Just too <strong>lazy</strong> to do it, right now ;-))</p>
<p dir="auto">Note also, that I added, in <strong>comments</strong>, regexes <strong><code>#3</code></strong> and <strong><code>#4</code></strong> if you want, also, highlight the <strong>end</strong> of <strong>here-docs</strong>, by placing the <strong>back-references</strong> <strong><code>\3</code></strong> and <strong><code>\4</code></strong>, inside <strong>parentheses</strong> =&gt; Two <strong>new</strong> groups <strong><code>5</code></strong> and <strong><code>6</code></strong></p>
<p dir="auto"><strong>Remark</strong> : Do <strong>not</strong> delete the <strong>empty</strong> group <strong><code>()</code></strong> in regexes <strong><code>#3</code></strong> and <strong><code>#4</code></strong> : it represents an <strong>empty</strong> group <strong><code>4</code></strong>, re-used by the <strong>back-reference</strong> <strong><code>\4</code></strong></p>
<hr />
<p dir="auto">And, of course, here is, below, the <strong><code>Test_Gilles.pl</code></strong> file, used to test these <strong><code>4</code></strong> <strong>new</strong> regexes :</p>
<pre><code class="language-diff">#--------------------------------------------------------------------------------------

# Various examples of INSTRUCTION WORDS q, qq, qr, qw, qx, highlighted with the PYTHON script

q/ok/error    q(ok);
qrw/ok/error    q(ok);
qq/ok/error;   qq{ok};
qr/ok/error;   qr(ok);
qw/ok/error;   qw[ok];
qq/ok/error;   qx(ok);

q        xokxerror      q (ok);
qq     hokherror;     qq {ok};
qr                      rokerror;    qr  (ok);
qw aokaerror;   qw [ok];
qx    zokzerror;   qx (ok);

#--------------------------------------------------------------------------------------

my var1 = q xfoobarx;
my var2 = q getservbyname g;
my var3 = q getservbyname getservbyent;
my var4 = qx{ verify &gt; NUL: };
my var5 = qr/$singer.*grand chanteur/;

#--------------------------------------------------------------------------------------

$bar = q(\n);              # or   $bar = '\n'

$foo = qq(\n);             # or   $bar = "\n" ( Interpolation )

$abc = qx(echo .);         # or   $abc = `echo .`

$perl_info  = qx(ps $$);   # That's Perl's $$
$shell_info = qx'ps $$';   # That's the new shell's $$

use POSIX qw( setlocale localeconv )
@EXPORT = qw( foo bar baz );

qr/PATTERN/msixpodualn     # Interpolation occurs unless delimiter is a SINGLE quote '

#--------------------------------------------------------------------------------------

$r = qr//;
$rex = qr/my.STRING/is;
$re = qr/$pattern/;
qr/$_/i

next if qr#^/usr/spool/uucp# ;

#--------------------------------------------------------------------------------------

 my $sentence_rx = qr&amp;
   (?: (?&lt;=^) | (?&lt;=\s) )  # after start-of-string or # whitespace
   \p{Lu}                  # capital letter
   .*?                     # a bunch of anything
   [.?!]                   # followed by a sentence ender
   (?= $ | \s )            # in front of end-of-string or whitespace
  &amp;sx;

#--------------------------------------------------------------------------------------

The cases where WHITESPACE must be used are when the QUOTING character is a WORD character :

q XfooX                    # Means the string 'foo'
qx XfooX                   # Means the string 'foo', too

qXfooX                     # WRONG !
qxXfooX                    # WRONG !

#--------------------------------------------------------------------------------------

# There can (and in some cases, must) be WHITESPACE between the operator and
# the quoting characters, EXCEPT when # is being used as the quoting character :
#
# q#foo# is parsed as the string foo , while q #foo# is the operator q followed by a
# comment. So, its argument will be taken from the next line.

q#foo#

q #foo#   #  =&gt; ONLY q SHOULD be colored ( Exception )

#--------------------------------------------------------------------------------------

# Instruction Word m, already CORRECTLY highlighted, by DEFAULT, by Scintilla :

mBPATTERNB   # KO ( normal )
mZPATTERNZ   # KO ( normal )
mbPATTERNb   # KO ( normal )
mzPATTERNz   # KO ( normal )
m0PATTERN0   # KO ( normal )
m9PATTERN9   # KO ( normal )
m_PATTERN_   # KO ( normal )

m BPATTERNB
m ZPATTERNZ
m zPATTERNz
m 0PATTERN0
m 9PATTERN9
m _PATTERN_

m(PATTERN)
m&lt;PATTERN&gt;
m[PATTERN]
m{PATTERN}

m (PATTERN)
m &lt;PATTERN&gt;
m [PATTERN]
m {PATTERN}

m!PATTERN!
m"PATTERN"
m#PATTERN#
m$PATTERN$
m%PATTERN%
m&amp;PATTERN&amp;
m'PATTERN'
m*PATTERN*
m+PATTERN+
m,PATTERN,
m-PATTERN-
m.PATTERN.
m/PATTERN/
m:PATTERN:
m;PATTERN;
m=PATTERN=
m?PATTERN?
m@PATTERN@
m\PATTERN\
m^PATTERN^
m`PATTERN`
m|PATTERN|
m~PATTERN~

m !PATTERN!
m "PATTERN"
m #PATTERN#
m $PATTERN$
m %PATTERN%
m &amp;PATTERN&amp;
m 'PATTERN'
m *PATTERN*
m +PATTERN+
m ,PATTERN,
m -PATTERN-
m .PATTERN.
m /PATTERN/
m :PATTERN:
m ;PATTERN;
m =PATTERN=
m ?PATTERN?
m @PATTERN@
m \PATTERN\
m ^PATTERN^
m `PATTERN`
m |PATTERN|
m ~PATTERN~

#--------------------------------------------------------------------------------------

# Instruction Word qr, CORRECTLY highlighted, with the PYTHON script :

qrBPATTERNB    # KO ( normal )
qrZPATTERNZ    # KO ( normal )
qrbPATTERNb    # KO ( normal )
qrzPATTERNz    # KO ( normal )
qr0PATTERN0    # KO ( normal )
qr9PATTERN9    # KO ( normal )
qr_PATTERN_    # KO ( normal )

qr BPATTERNB
qr ZPATTERNZ
qr bPATTERNb
qr zPATTERNz
qr 0PATTERN0
qr 9PATTERN9
qr _PATTERN_

qr(PATTERN)
qr&lt;PATTERN&gt;
qr[PATTERN]
qr{PATTERN}

qr (PATTERN)
qr &lt;PATTERN&gt;
qr [PATTERN]
qr {PATTERN}

qr!PATTERN!
qr"PATTERN"
qr#PATTERN#
qr$PATTERN$
qr%PATTERN%
qr&amp;PATTERN&amp;
qr'PATTERN'
qr*PATTERN*
qr+PATTERN+
qr,PATTERN,
qr-PATTERN-
qr.PATTERN.
qr/PATTERN/
qr:PATTERN:
qr;PATTERN;
qr=PATTERN=
qr?PATTERN?
qr@PATTERN@
qr\PATTERN\
qr^PATTERN^
qr`PATTERN`
qr|PATTERN|
qr~PATTERN~

qr !PATTERN!
qr "PATTERN"
qr #PATTERN#
qr $PATTERN$
qr %PATTERN%
qr &amp;PATTERN&amp;
qr 'PATTERN'
qr *PATTERN*
qr +PATTERN+
qr ,PATTERN,
qr -PATTERN-
qr .PATTERN.
qr /PATTERN/
qr :PATTERN:
qr ;PATTERN;
qr =PATTERN=
qr ?PATTERN?
qr @PATTERN@
qr \PATTERN\
qr ^PATTERN^
qr `PATTERN`
qr |PATTERN|
qr ~PATTERN~

#--------------------------------------------------------------------------------------

# For completeness, &lt;&lt; as shift operator

$b = (1 &lt;&lt; 5);

#  Here-documents, CORRECTLY highlighted, with the PYTHON script :

$x=&lt;&lt;TEXT;
Plain text here
TEXT

$x=&lt;&lt;'TEXT';
Plain text here
TEXT

$x=&lt;&lt;"TEXT";
Plain text here
TEXT

$x=&lt;&lt;'TE"XT';
Plain text here
TE"XT

$x=&lt;&lt;"TE'XT";
Plain text here
TE'XT

# Here-documents, with a SPACE char, before the SEMI-COLON

$x=&lt;&lt;TEXT ;
Plain text here
TEXT

$x=&lt;&lt;'TEXT' ;
Plain text here
TEXT

$x=&lt;&lt;"TEXT" ;
Plain text here
TEXT

$x=&lt;&lt;'TE"XT' ;
Plain text here
TE"XT

$x=&lt;&lt;"TE'XT" ;
Plain text here
TE'XT


#  Here-documents, with the ESCAPED delimiter in the TEXT, CORRECTLY highlighted, too !

$x=&lt;&lt;'TE\'XT';
Plain text here
TE'XT

$x=&lt;&lt;"TE\"XT";
Plain text here
TE"XT

# The SAME + a SPACE char, before the SEMI-COLON

$x=&lt;&lt;'TE\'XT' ;
Plain text here
TE'XT

$x=&lt;&lt;"TE\"XT" ;
Plain text here
TE"XT

# Here-documents with SPACE highlights as operator, in Notepad++

$x=&lt;&lt; 'TEXT';
Plain text here
TEXT

$x=&lt;&lt; "TEXT";
Plain text here
TEXT

$x=&lt;&lt; 'TE"XT';
Plain text here
TE"XT

$x=&lt;&lt; "TE'XT";
Plain text here
TE'XT

# The SAME + a SPACE char, before the SEMI-COLON

$x=&lt;&lt; 'TEXT' ;
Plain text here
TEXT

$x=&lt;&lt; "TEXT" ;
Plain text here
TEXT

$x=&lt;&lt; 'TE"XT' ;
Plain text here
TE"XT

$x=&lt;&lt; "TE'XT" ;
Plain text here
TE'XT

#  Here-docs with SPACE highlights as operator, and the ESCAPED delimiter in TEXT, CORRECTLY highlighted !

$x=&lt;&lt; 'TE\'XT';
Plain text here
TE'XT

$x=&lt;&lt; "TE\"XT";
Plain text here
TE"XT

# The SAME + a SPACE char, before the SEMI-COLON

$x=&lt;&lt; 'TE\'XT' ;
Plain text here
TE'XT

$x=&lt;&lt; "TE\"XT" ;
Plain text here
TE"XT


#-----  Note that MULTIPLE Here-docs are NOT managed, yet -:(( -----

print &lt;&lt;"foo", &lt;&lt;"bar"; # you can stack them
I said foo.
foo
I said bar.
bar

myfunc(&lt;&lt; "THIS", 23, &lt;&lt;'THAT');
Here's a line
or two.
THIS
and here's another.
THAT

#------------------ END ----------------------------
</code></pre>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S</strong> :</p>
<p dir="auto">Here a <strong>simple</strong> example of the <strong><code>(?|......|.......|.......)</code></strong></p>
<p dir="auto">Let’s suppose that you want to match these <strong>two</strong> expressions :</p>
<p dir="auto"><strong>foo12345fooABCDE</strong><br />
<strong>bar12345barABCDE</strong></p>
<p dir="auto">A classic syntax should be <strong><code>(foo)12345\1ABCDE|(bar)12345\2ABCDE</code></strong>, where group <strong><code>1</code></strong> = <strong>foo</strong> and group <strong><code>2</code></strong> = <strong>bar</strong></p>
<p dir="auto">But you can use this second <strong>shorter</strong> regex <strong><code>(?|(foo)|(bar))12345\1ABCDE</code></strong>, where group <strong><code>1</code></strong> represents, either, <strong>foo</strong> or <strong>bar</strong>, depending of the <strong>part</strong> of the <strong>alternative</strong> has matched</p>
<p dir="auto">For a <strong>more complete</strong> example, refer to :</p>
<p dir="auto"><a href="https://www.boost.org/doc/libs/1_55_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html#boost_regex.syntax.perl_syntax.branch_reset" rel="nofollow ugc">https://www.boost.org/doc/libs/1_55_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html#boost_regex.syntax.perl_syntax.branch_reset</a></p>
<p dir="auto">This <strong><code>(?|PATTERN)</code></strong> syntax is, commonly, called a <strong>branch-reset</strong> !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41482</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41482</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Fri, 22 Mar 2019 19:35:43 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Thu, 21 Mar 2019 12:49:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14711">@Gilles-Maisonneuve</a></p>
<p dir="auto">Thank you for your kind words.<br />
I have enjoyed developing the script with you and the<br />
discussion afterwards was also helpful and intersting<br />
as it pointed out that the script comments aren’t 100% bulletproof.<br />
And please don’t hesitate to post here if you find something that<br />
doesn’t work the way you expected it - just let us know, in the end<br />
we can all benefit from it.</p>
<p dir="auto">Regarding the off topic comments, these were not meant to be insulting.<br />
Sometimes there is a sound in it that is only understood if you read through<br />
several other answers - they are mostly nice but sometimes they do provoke<br />
but they are still meant to be nice or at least helpful.<br />
The one with the summaries, for example, was from another thread where<br />
I caused a confusion, because of my recklessness, that was only cleared up<br />
a few posts later and then I gave a “manager summary” to among other things,<br />
to make life easier for future readers. Seems to become a running gag now :-)</p>
<p dir="auto">I agree with you, Python is in the beginning odd, especially<br />
when coming from a different language.<br />
It took some time getting used to it and I had my difficulties too,<br />
but now I find the language super - especially Python3, which is<br />
by the way not supported by the PythonScript plugin,  :-(<br />
has syntax constructs and language extensions that I really like.</p>
<p dir="auto">So, have a nice weekend too.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41470</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41470</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Thu, 21 Mar 2019 12:49:41 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Wed, 20 Mar 2019 20:36:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14711">@Gilles-Maisonneuve</a> said:</p>
<blockquote>
<p dir="auto">pissed at my garbage, this includes you Alan</p>
</blockquote>
<p dir="auto">Oh, not at all…at least after 98 messages a positive outcome!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41462</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41462</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 20 Mar 2019 20:36:48 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Wed, 20 Mar 2019 20:11:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a><br />
Replying at the message “Lunch break…” with all the explainations.</p>
<ol>
<li>
<p dir="auto">THANK YOU ! I start enjoying Python since I read you.<br />
Well, I’ll never be a disciple, because not fan of OO and have difficulty to accept a language where the tabulations and spaces define the code syntax… reminds me too much of my youth with the punch cards and the punched paper roll (and yes, I’m that old), but it’s kind of fun to read when one understand it better.<br />
Your analogies with Perl made it very comprehensible, very kind of you.</p>
</li>
<li>
<p dir="auto">** Y Y Y Y    E E E E   S S S S  ! ! ! ! ! ! **<br />
It works. I just changed a ‘+’ into a ‘*’ after the first ‘\h’ to allow for no horizontal space between the preceding keyword / Perl-separator and the here doc starter (‘&lt;&lt;’). So my (yours with my ridiculous pinch of salt) regexp is now:</p>
<p dir="auto">regexes[(4, (0,0,224))] = (r’(?s-i)((&lt;&lt;)\h*([‘"])(\w+?)\3\h*;.*?\4)’, [1,3])<br />
^^</p>
</li>
</ol>
<p dir="auto">Thank to you and your patience (and for the readers, pissed at my garbage, this includes you Alan, and BTW ignore my perl joke, I was upset by the tone you used and perhaps, even further by the fact that you were right [chcp needed to get the accents on the French vowels on a Windows Perl console]).</p>
<p dir="auto">I was <em>without-a-clue</em> and you saved my day. And now…</p>
<p dir="auto"><em>Already several adventures have begun to take shape which can be solved by no-one else. Right, Eko ?<br />
Right you are, Meta Chuh.<br />
And so, without further ado… …I hereby declare this case… …closed.</em></p>
<p dir="auto">{to sum up the solution provided by Ekopalypse in this thread of discussion}:</p>
<pre><code>regexes[(1, (255,0,128))] = (r'\bq[rwqx]{0,1}\b([^\h]).*?\1|(\bq[rwqx]{0,1}\b\h+(\w).*?\3)', [0])
regexes[(2, (255,0,128))] = (r'\bq[rwqx]{0,1}\b\h*(\(.+?\)|\[.+?\]|\{.+?\})', [0])
regexes[(4, (0,112,112))] = (r'(?s-i)((&lt;&lt;)\h*([\'"])(\w+?)\3\h*;.*?\4)', [1,3])
</code></pre>
<p dir="auto">Allow you to colorize your Perl ‘q*’ keywords and args with color RGB 255,0,128 and your here-docs with color RGB 0,112,112 in Notepad-plus-plus, using “Python Script” plugin. By so, you correct the coloring limitation of Scintilla Library for those keywords in Perl.</p>
<p dir="auto">Hope this summary will be satisfying enough for “Meta Chuh al.”.</p>
<p dir="auto">Have nice week (end of) all of you.</p>
<p dir="auto">Gilles</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41461</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41461</guid><dc:creator><![CDATA[Gilles Maisonneuve]]></dc:creator><pubDate>Wed, 20 Mar 2019 20:11:52 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Wed, 20 Mar 2019 12:30:18 GMT]]></title><description><![CDATA[<p dir="auto">LOL - back to business</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41446</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41446</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Wed, 20 Mar 2019 12:30:18 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Wed, 20 Mar 2019 12:27:59 GMT]]></title><description><![CDATA[<p dir="auto">if a short manager summary is, in your eyes, a fully featured guide, covering all eventualities, based on all caveats of the whole topic … then yes 😉</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41444</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41444</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Wed, 20 Mar 2019 12:27:59 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Wed, 20 Mar 2019 12:22:25 GMT]]></title><description><![CDATA[<p dir="auto">You mean a short manager summary I guess :-D</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41442</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41442</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Wed, 20 Mar 2019 12:22:25 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Wed, 20 Mar 2019 12:21:28 GMT]]></title><description><![CDATA[<p dir="auto">maybe <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a> will write a resuming manual, once this is over … i refuse :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41441</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41441</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Wed, 20 Mar 2019 12:21:28 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Wed, 20 Mar 2019 12:09:46 GMT]]></title><description><![CDATA[<p dir="auto">No idea what the “chcp 1250…” posting was supposed to be saying to me. :)</p>
<p dir="auto">This thread gets my vote for the biggest jumbled mess in the history of the community. :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41437</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41437</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 20 Mar 2019 12:09:46 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Wed, 20 Mar 2019 12:02:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14711">@Gilles-Maisonneuve</a></p>
<p dir="auto">Lunch break :-)</p>
<p dir="auto">First, I’m sorry not to telling you that the single quote has to be escaped as it was<br />
used to denote a python string - good, you figured it already out.</p>
<p dir="auto">Let me break down the parts of that python code</p>
<pre><code>regexes = OrderedDict()
regexes[(3, (255,0,0))] = (r'(?s)(\s*(&lt;&lt;)\s*("{0,1}.+"{0,1})\s*;.*?\3)', [0])
</code></pre>
<p dir="auto">regexes is variable, containing an OrderedDict class instance.<br />
OrderedDict is more or less the same as a perl associative array or hash</p>
<p dir="auto">regexes[] is the python way to access a key in that hash, like in perl regexes{}<br />
regexes[()] the round bracket denotes a python tuple, in perl a list I guess (immutable)<br />
the python tuple contains the items 3 and (255,0,0) &lt;- this is again a tuple<br />
The number 3 is here to create an unique key - has nothing to do with the regex itself.<br />
So, regexes[(3, (255,0,0))] means, get me the value for key (3, (255,0,0)) from dict(hash) regexes</p>
<p dir="auto">The value is (r’(?s)(\s*(&lt;&lt;)\s*(“{0,1}.+”{0,1})\s*;.*?\3)‘, [0])<br />
Again, a python tuple containing the items r’…’ (raw string) and a list [] (in perl an array = mutable)<br />
Everything within the raw string is the regex to be searched for and the list contains the information<br />
which match group should be used for coloring<br />
[0] is always the overall match of the complete regex and [1] would be the result from group 1,<br />
[2] from group 2 and [1,2] from group 1 and group 2</p>
<p dir="auto">So, in terms of regular expressions only the value part of the regexes hash/dict is of interest.<br />
For searching only the raw string and for coloring which part was defined in the list [].</p>
<p dir="auto">Does this makes sense to you?</p>
<p dir="auto">The reason why this regex</p>
<pre><code>regexes[(4, (0,0,224))] = (r'(?s-i)((&lt;&lt;)\h+([\'"])(\w+?)\2\h*;.*?\3)', [1,3])
</code></pre>
<p dir="auto">doesn’t do what you want is that you use 4 groups now whereas <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> has<br />
removed the outer matching group brackets.</p>
<p dir="auto"><code>(?s-i)(&lt;&lt;)(['"]?)(\w+?)\2\h*;.*?\3</code></p>
<p dir="auto">In order to make it work either use</p>
<p dir="auto"><code>regexes[(4, (0,0,224))] = (r'(?s-i)(&lt;&lt;)\h+([\'"])(\w+?)\2\h*;.*?\3', [1,3])</code><br />
or<br />
<code>regexes[(4, (0,0,224))] = (r'(?s-i)((&lt;&lt;)\h+([\'"])(\w+?)\3\h*;.*?\4)', [1,3])</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/41436</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41436</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Wed, 20 Mar 2019 12:02:15 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Wed, 20 Mar 2019 08:56:06 GMT]]></title><description><![CDATA[<p dir="auto">J’ai tellement l’habitude d’utiliser $1, $2, …, qui, eux, ne fonctionnent pas dans un simple ‘match’ mais uniquement dans un ‘substitute’, que je ne connaissais pas cette façon de répéter les ‘patterns’ de ‘matching’. J’ai appris quelque chose.<br />
Dont acte.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41434</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41434</guid><dc:creator><![CDATA[Gilles Maisonneuve]]></dc:creator><pubDate>Wed, 20 Mar 2019 08:56:06 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Wed, 20 Mar 2019 08:50:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a></p>
<pre><code>chcp 1250 &gt;NUL: &amp; perl -e "$var=q(Alan Kilborn est déplaisant dans sa façon de s'exprimer mais il a raison.); for my $p ('\t','\s') {print qq{\$p=$p},$var=~m/($p)déplaisant\1/x?$var:qq{n'en déplaise},qq{\n} ;};" &amp; chcp 850 &gt;NUL:

$p=\tn'en déplaise
$p=\sAlan Kilborn est déplaisant dans sa façon de s'exprimer mais il a raison.
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/41433</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41433</guid><dc:creator><![CDATA[Gilles Maisonneuve]]></dc:creator><pubDate>Wed, 20 Mar 2019 08:50:04 GMT</pubDate></item><item><title><![CDATA[Reply to Perl language syntax highlighting troubles (bug or limitation ?) on Wed, 20 Mar 2019 08:37:56 GMT]]></title><description><![CDATA[<p dir="auto">if I modify the rule like:</p>
<pre><code>regexes[(4, (0,0,224))] = (r'(?s-i)((&lt;&lt;)\h+([\'"])(\w+?)\2\h*;.*?\3)', [1,3])
</code></pre>
<p dir="auto">I don’t get any longer a syntax error in Python BUT I get no coloring for the here doc either…</p>
<p dir="auto">Any idea ?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/41432</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/41432</guid><dc:creator><![CDATA[Gilles Maisonneuve]]></dc:creator><pubDate>Wed, 20 Mar 2019 08:37:56 GMT</pubDate></item></channel></rss>