Fix test and re-add triple_string support in python highlighting
Triple strings are now distinct from docstrings, triple strings only preceeded by blanks on the line are considered docstrings. Avoid highlighting of the closing marker using a lookahead, this is not fully correct as it will break on a double quote triple docstring containing a single quote triple string but that seems improbable enough; if we encounter this in the wild we can split the two docstring formats into separate regions.
This commit is contained in:
parent
024e0a04f2
commit
14f7d2637c
|
@ -36,6 +36,7 @@ provide-module python %§
|
||||||
add-highlighter shared/python regions
|
add-highlighter shared/python regions
|
||||||
add-highlighter shared/python/code default-region group
|
add-highlighter shared/python/code default-region group
|
||||||
add-highlighter shared/python/docstring region -match-capture ^\h*("""|''') (?<!\\)(?:\\\\)*("""|''') regions
|
add-highlighter shared/python/docstring region -match-capture ^\h*("""|''') (?<!\\)(?:\\\\)*("""|''') regions
|
||||||
|
add-highlighter shared/python/triple_string region -match-capture ("""|''') (?<!\\)(?:\\\\)*("""|''') fill string
|
||||||
add-highlighter shared/python/double_string region '"' (?<!\\)(\\\\)*" fill string
|
add-highlighter shared/python/double_string region '"' (?<!\\)(\\\\)*" fill string
|
||||||
add-highlighter shared/python/single_string region "'" (?<!\\)(\\\\)*' fill string
|
add-highlighter shared/python/single_string region "'" (?<!\\)(\\\\)*' fill string
|
||||||
add-highlighter shared/python/documentation region '##' '$' fill documentation
|
add-highlighter shared/python/documentation region '##' '$' fill documentation
|
||||||
|
@ -54,8 +55,7 @@ add-highlighter shared/python/code/ regex '\b\d+\.' 0:value
|
||||||
add-highlighter shared/python/code/ regex '\b\d+\+\d+[jJ]\b' 0:value
|
add-highlighter shared/python/code/ regex '\b\d+\+\d+[jJ]\b' 0:value
|
||||||
|
|
||||||
add-highlighter shared/python/docstring/ default-region fill comment
|
add-highlighter shared/python/docstring/ default-region fill comment
|
||||||
add-highlighter shared/python/docstring/ region '>>> \K' '\z' ref python
|
add-highlighter shared/python/docstring/ region '(>>>|\.\.\.) \K' (?=''')|(?=""") ref python
|
||||||
add-highlighter shared/python/docstring/ region '\.\.\. \K' '\z' ref python
|
|
||||||
|
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
# Grammar
|
# Grammar
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
ui_out '{ "jsonrpc": "2.0", "method": "set_ui_options", "params": [{}] }'
|
ui_out '{ "jsonrpc": "2.0", "method": "set_ui_options", "params": [{}] }'
|
||||||
ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "attributes": ["final_fg","final_bg"] }, "contents": "\"" }, { "face": { "fg": "magenta", "bg": "default", "attributes": [] }, "contents": "\"\">>> " }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\"\"\"\u000a" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] }'
|
ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "attributes": ["final_fg","final_bg"] }, "contents": "\"" }, { "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": "\"\">>> \"\"\"" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\u000a" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] }'
|
||||||
ui_out '{ "jsonrpc": "2.0", "method": "menu_hide", "params": [] }'
|
ui_out '{ "jsonrpc": "2.0", "method": "menu_hide", "params": [] }'
|
||||||
ui_out '{ "jsonrpc": "2.0", "method": "info_hide", "params": [] }'
|
ui_out '{ "jsonrpc": "2.0", "method": "info_hide", "params": [] }'
|
||||||
ui_out '{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "out 1:1 " }, { "face": { "fg": "black", "bg": "yellow", "attributes": [] }, "contents": "" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] }'
|
ui_out '{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "out 1:1 " }, { "face": { "fg": "black", "bg": "yellow", "attributes": [] }, "contents": "" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] }'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user