On Sun, Jul 9, 2017 at 10:02 AM, Adrian <[email protected]> wrote:

​> ​
Please advise on how to make one color.  Just as""" """works correctly in
python mode.

​Why not start with the python rules as your guide. From modes/python.py:

def python_rule1(colorer, s, i):
    return colorer.match_span(s, i, kind="literal2", begin="\"\"\"",
end="\"\"\"",
        at_line_start=False, at_whitespace_end=False, at_word_start=False,
        delegate="",exclude_match=False,
        no_escape=False, no_line_break=False, no_word_break=False)

def python_rule2(colorer, s, i):
    return colorer.match_span(s, i, kind="literal2", begin="'''", end="'''",
        at_line_start=False, at_whitespace_end=False, at_word_start=False,
        delegate="",exclude_match=False,
        no_escape=False, no_line_break=False, no_word_break=False)

Now do the following:

- Copy the above to modes/php.py

- Change their names to unique names, php_rule_N, php_rule_N+1.

- Add traces to these new methods so you can see when they fire.

- *Add them to ​the appropriate rulesDict*.  This is the key.  Leo won't
try to match them unless the to-be-colorized-next character matches the
lead-in character in the rulesDict.  The rulesDictDict has entries for each
individual rulesDict.

The lead-in character for the first pattern is a double quote. The lead-in
character for the second pattern is a single quote.

- Define @color php_literal2 = red to make for debugging.

​HTH.  Please feel free to ask more questions.

Edward​

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to