diff --git a/autotests/folding/test.yaml.fold b/autotests/folding/test.yaml.fold --- a/autotests/folding/test.yaml.fold +++ b/autotests/folding/test.yaml.fold @@ -1,4 +1,4 @@ -# YAML test +# YAML test # Comment @@ -40,28 +40,28 @@ <<: *base age: 10 -!!seq [ +!!seq [ !!str "Block scalar\n", !!map { ? &B1 !!str "foo" : !!str "bar", ? !!str "baz" - : *B1, - }, + : *B1, + }, !!map { !!str "sun" : !!str "yellow", }, -] +] -!!map { +!!map { !!str "Booleans": !!seq [ !!bool "true", !!bool "false" ], !!str "Invalid": !!seq [ # Rejected by the schema True, Null, 0o7, 0x3A, +12.3, ], -} +} --- !clarkevans.com,2002/graph/^shape - !^circle @@ -74,7 +74,7 @@ # Literal/Folded Style ---- | +--- | \//||\/|| // || ||__ @@ -89,63 +89,69 @@ : | and this is it's literal value -# Capture the indentation of the Key. The "-" and "?" operators +# Capture the indentation of the Key. The "-" and "?" operators # are considered as part of the indentation: key1: - key2: !!hello | + key2: !!hello | literal: " text" # [ ] # literal { } key3: |+ literal: 'text' - no-literal: " text" + no-literal: " text" #comment -? key: |- +? key: |- literal: "text" - no-literal: "text" + no-literal: "text" - item1 - item2 - - - - key: >- + - - - key: >- "literal text" # [ ] 'literal block' - no-literal: 12 + no-literal: 12 -? - - - - ? key: | +? - - - - ? key: | literal: [ ] - no-literal: [ ] + no-literal: [ ] # Capture the indentation of the literal/folded operator: -|- +|- literal: "text" !!binary | R0lGODlhDAAMAIQAAP//9/X 17unp5WZmZgAAAOfn515eXv Pz7Y6OjuDg4J+fn5OTk6enp 56enmleECcgggoBADs= -key1: +key1: key2: - | + | literal: "text" - key3: - !!str | + key3: + !!str | literal: "text" #literal -# Capture the indentation of the operators "-" or "?": -? - - - !!hello |+ +# Capture the indentation of the operators "-" or "?": +? - - - !!hello |+ literal: "sdfsd" # [ ] - no-literal: "sdfsd" # [ ] + no-literal: "sdfsd" # [ ] -- - - - >- +- - - - >- literal: "text" #literal - no-literal: "text" + no-literal: "text" # This implementation of literal blocks has a limitation: # it only supports 6 dashes at most. - - - - - - - key: | - literal? "dfsf" + literal? "dfsf" + +# Only comments after spaces & strings in multiline attributes (bug #407060) +reg_list: +- reg: ?#XPath //div[@class="product_item cf"][@id] ))(?sx) + id="product(?P[^"]+)" + .+?

]+>(?P[^<]+)</a></h4> diff --git a/autotests/html/example.rmd.html b/autotests/html/example.rmd.html --- a/autotests/html/example.rmd.html +++ b/autotests/html/example.rmd.html @@ -5,10 +5,10 @@ <meta name="generator" content="KF5::SyntaxHighlighting (R Markdown)"/> </head><body style="color:#1f1c1b"><pre> --- -<span style="color:#644a9b;">title:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"test"</span> -<span style="color:#644a9b;">author:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"me"</span> -<span style="color:#644a9b;">date:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"07.10.2014"</span> -<span style="color:#644a9b;">output:</span><span style="color:#0057ae;"> html_document</span> +<span style="color:#644a9b;font-weight:bold;">title</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"test"</span> +<span style="color:#644a9b;font-weight:bold;">author</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"me"</span> +<span style="color:#644a9b;font-weight:bold;">date</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"07.10.2014"</span> +<span style="color:#644a9b;font-weight:bold;">output</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> html_document</span> --- This is a simple test document. It shows syntax highlighting switches between YAML (above), R blocks diff --git a/autotests/html/test.yaml.html b/autotests/html/test.yaml.html --- a/autotests/html/test.yaml.html +++ b/autotests/html/test.yaml.html @@ -8,151 +8,157 @@ <span style="color:#898887;"># Comment</span> -<span style="color:#644a9b;">key:</span><span style="color:#0057ae;"> value</span> -<span style="color:#644a9b;">another key:</span><span style="color:#0057ae;"> Another value</span> -<span style="color:#644a9b;">boolean:</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;">true</span> -<span style="color:#644a9b;">null_value:</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;">null</span> -<span style="color:#644a9b;">single quotes:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">'have </span><span style="color:#3daee9;">''</span><span style="color:#bf0303;">one</span><span style="color:#3daee9;">''</span><span style="color:#bf0303;"> escape pattern'</span> -<span style="color:#644a9b;">double quotes:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"have many: </span><span style="color:#3daee9;">\"</span><span style="color:#bf0303;">, </span><span style="color:#3daee9;">\0</span><span style="color:#bf0303;">, </span><span style="color:#3daee9;">\t</span><span style="color:#bf0303;">, </span><span style="color:#3daee9;">\u263A</span><span style="color:#bf0303;">, </span><span style="color:#3daee9;">\x0d\x0a</span><span style="color:#bf0303;"> == </span><span style="color:#3daee9;">\r\n</span><span style="color:#bf0303;">, and more."</span> - -<span style="color:#644a9b;">decimal:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">+12345</span> -<span style="color:#644a9b;">negative:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">-1_4</span> -<span style="color:#644a9b;">zero:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">0</span> -<span style="color:#644a9b;">octal:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">0o14</span> -<span style="color:#644a9b;">another octal:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">014_2</span> -<span style="color:#644a9b;">hexadecimal:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">0x_Ca2</span> -<span style="color:#644a9b;">float:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">1.23015e+3</span> -<span style="color:#644a9b;">exponential:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">12.3015e+02</span> -<span style="color:#644a9b;">fixed:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">12__30.1_5</span> -<span style="color:#644a9b;">sexagesimal:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">19_0:20:30.15</span> -<span style="color:#644a9b;">sexagesimal-inline:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span><span style="color:#b08000;">123:45:12</span><span style="font-weight:bold;">,</span> <span style="color:#b08000;">123:45:32.234_32</span><span style="font-weight:bold;">,</span> <span style="color:#b08000;">+12__3:23</span><span style="font-weight:bold;">]</span> -<span style="color:#644a9b;">infinity:</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">!!float</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">.inf</span> -<span style="color:#644a9b;">not a number:</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">!!float</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">.NaN</span> -<span style="color:#644a9b;">datetime:</span><span style="color:#0057ae;"> 2001-12-15T02:59:43.1Z</span> -<span style="color:#644a9b;">date:</span><span style="color:#0057ae;"> 2002-12-14</span> - -<span style="color:#644a9b;">json_map:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">{</span><span style="color:#644a9b;">"key":</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"value"</span><span style="font-weight:bold;">}</span> -<span style="color:#644a9b;">json_seq:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span><span style="color:#b08000;">3</span><span style="font-weight:bold;">,</span> <span style="color:#b08000;">2</span><span style="font-weight:bold;">,</span> <span style="color:#b08000;">-.inf</span><span style="font-weight:bold;">,</span> <span style="color:#bf0303;">"value"</span><span style="font-weight:bold;">]</span> -<span style="color:#644a9b;">another key:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">{</span><span style="color:#644a9b;">key:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span><span style="color:#b08000;">+0x12a</span><span style="font-weight:bold;">,</span> <span style="font-weight:bold;">,</span> <span style="color:#644a9b;">!!hello:</span><span style="color:#0057ae;"> bye</span><span style="font-weight:bold;">,</span> <span style="color:#b08000;">1</span><span style="font-weight:bold;">,</span> <span style="color:#924c9d;">off</span><span style="font-weight:bold;">,</span> <span style="font-weight:bold;">{</span><span style="color:#644a9b;">a:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[{</span><span style="color:#644a9b;">b:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">''</span><span style="font-weight:bold;">}]}]}</span> - -<span style="font-weight:bold;">?</span> <span style="color:#0057ae;">!!python/tuple</span> <span style="font-weight:bold;">[</span><span style="color:#b08000;">5</span><span style="font-weight:bold;">,</span> <span style="color:#b08000;">7</span><span style="font-weight:bold;">]</span> -<span style="color:#644a9b;">:</span><span style="color:#0057ae;"> Fifty Seven</span> - -<span style="font-weight:bold;">?</span> <span style="color:#644a9b;">set2:</span> - <span style="color:#644a9b;">item1:</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;">null</span> - <span style="color:#644a9b;">item2:</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;">null</span> - -<span style="color:#644a9b;">foo:</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">&foo</span> - <span style="color:#644a9b;"><<:</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">*base</span> - <span style="color:#644a9b;">age:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">10</span> - -<span style="color:#0057ae;">!!seq</span> <span style="font-weight:bold;">[</span> - <span style="color:#0057ae;">!!str</span> <span style="color:#bf0303;">"Block scalar</span><span style="color:#3daee9;">\n</span><span style="color:#bf0303;">"</span><span style="font-weight:bold;">,</span> - <span style="color:#0057ae;">!!map</span> <span style="font-weight:bold;">{</span> - <span style="font-weight:bold;">?</span> <span style="color:#0057ae;">&B1</span> <span style="color:#0057ae;">!!str</span> <span style="color:#bf0303;">"foo"</span> - <span style="color:#644a9b;">:</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">!!str</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"bar"</span><span style="font-weight:bold;">,</span> - <span style="font-weight:bold;">?</span> <span style="color:#0057ae;">!!str</span> <span style="color:#bf0303;">"baz"</span> - <span style="color:#644a9b;">:</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">*B1,</span> +<span style="color:#644a9b;font-weight:bold;">key</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> value</span> +<span style="color:#644a9b;font-weight:bold;">another key</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> Another value</span> +<span style="color:#644a9b;font-weight:bold;">boolean</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;">true</span> +<span style="color:#644a9b;font-weight:bold;">null_value</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;">null</span> +<span style="color:#644a9b;font-weight:bold;">single quotes</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">'have </span><span style="color:#3daee9;">''</span><span style="color:#bf0303;">one</span><span style="color:#3daee9;">''</span><span style="color:#bf0303;"> escape pattern'</span> +<span style="color:#644a9b;font-weight:bold;">double quotes</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"have many: </span><span style="color:#3daee9;">\"</span><span style="color:#bf0303;">, </span><span style="color:#3daee9;">\0</span><span style="color:#bf0303;">, </span><span style="color:#3daee9;">\t</span><span style="color:#bf0303;">, </span><span style="color:#3daee9;">\u263A</span><span style="color:#bf0303;">, </span><span style="color:#3daee9;">\x0d\x0a</span><span style="color:#bf0303;"> == </span><span style="color:#3daee9;">\r\n</span><span style="color:#bf0303;">, and more."</span> + +<span style="color:#644a9b;font-weight:bold;">decimal</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">+12345</span> +<span style="color:#644a9b;font-weight:bold;">negative</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">-1_4</span> +<span style="color:#644a9b;font-weight:bold;">zero</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">0</span> +<span style="color:#644a9b;font-weight:bold;">octal</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">0o14</span> +<span style="color:#644a9b;font-weight:bold;">another octal</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">014_2</span> +<span style="color:#644a9b;font-weight:bold;">hexadecimal</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">0x_Ca2</span> +<span style="color:#644a9b;font-weight:bold;">float</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">1.23015e+3</span> +<span style="color:#644a9b;font-weight:bold;">exponential</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">12.3015e+02</span> +<span style="color:#644a9b;font-weight:bold;">fixed</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">12__30.1_5</span> +<span style="color:#644a9b;font-weight:bold;">sexagesimal</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">19_0:20:30.15</span> +<span style="color:#644a9b;font-weight:bold;">sexagesimal-inline</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span><span style="color:#b08000;">123:45:12</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">123:45:32.234_32</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">+12__3:23</span><span style="font-weight:bold;">]</span> +<span style="color:#644a9b;font-weight:bold;">infinity</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">!!float</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">.inf</span> +<span style="color:#644a9b;font-weight:bold;">not a number</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">!!float</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">.NaN</span> +<span style="color:#644a9b;font-weight:bold;">datetime</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> 2001-12-15T02:59:43.1Z</span> +<span style="color:#644a9b;font-weight:bold;">date</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> 2002-12-14</span> + +<span style="color:#644a9b;font-weight:bold;">json_map</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">{</span><span style="color:#644a9b;font-weight:bold;">"key"</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"value"</span><span style="font-weight:bold;">}</span> +<span style="color:#644a9b;font-weight:bold;">json_seq</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span><span style="color:#b08000;">3</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">2</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">-.inf</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"value"</span><span style="font-weight:bold;">]</span> +<span style="color:#644a9b;font-weight:bold;">another key</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">{</span><span style="color:#644a9b;font-weight:bold;">key</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span><span style="color:#b08000;">+0x12a</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">!!hello</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> bye</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">1</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;">off</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">{</span><span style="color:#644a9b;font-weight:bold;">a</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[{</span><span style="color:#644a9b;font-weight:bold;">b</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">''</span><span style="font-weight:bold;">}]}]}</span> + +<span style="font-weight:bold;">?</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">!!python/tuple</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span><span style="color:#b08000;">5</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">7</span><span style="font-weight:bold;">]</span> +<span style="font-weight:bold;">:</span><span style="color:#0057ae;"> Fifty Seven</span> + +<span style="font-weight:bold;">?</span><span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">set2</span><span style="font-weight:bold;">:</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">item1</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;">null</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">item2</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;">null</span> + +<span style="color:#644a9b;font-weight:bold;">foo</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">&foo</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;"><<</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">*base</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">age</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">10</span> + +<span style="color:#006e28;">!!seq</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span> +<span style="color:#0057ae;"> </span><span style="color:#006e28;">!!str</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"Block scalar</span><span style="color:#3daee9;">\n</span><span style="color:#bf0303;">"</span><span style="font-weight:bold;">,</span> +<span style="color:#0057ae;"> </span><span style="color:#006e28;">!!map</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">{</span> +<span style="color:#0057ae;"> </span><span style="font-weight:bold;">?</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">&B1</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">!!str</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"foo"</span> +<span style="color:#0057ae;"> </span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">!!str</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"bar"</span><span style="font-weight:bold;">,</span> +<span style="color:#0057ae;"> </span><span style="font-weight:bold;">?</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">!!str</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"baz"</span> +<span style="color:#0057ae;"> </span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">*B1,</span> +<span style="color:#0057ae;"> </span><span style="font-weight:bold;">},</span> +<span style="color:#0057ae;"> </span><span style="color:#006e28;">!!map</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">{</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">!!str "sun" </span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">!!str</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"yellow"</span><span style="font-weight:bold;">,</span> <span style="color:#0057ae;"> </span><span style="font-weight:bold;">},</span> - <span style="color:#0057ae;">!!map</span> <span style="font-weight:bold;">{</span> - <span style="color:#644a9b;">!!str "sun" :</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">!!str</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"yellow"</span><span style="font-weight:bold;">,</span> - <span style="font-weight:bold;">},</span> <span style="font-weight:bold;">]</span> -<span style="color:#0057ae;">!!map</span> <span style="font-weight:bold;">{</span> - <span style="color:#644a9b;">!!str "Booleans":</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">!!seq</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span> - <span style="color:#0057ae;">!!bool</span> <span style="color:#bf0303;">"true"</span><span style="font-weight:bold;">,</span> <span style="color:#0057ae;">!!bool</span> <span style="color:#bf0303;">"false"</span> - <span style="font-weight:bold;">],</span> - <span style="color:#644a9b;">!!str "Invalid":</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">!!seq</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span> - <span style="color:#898887;"># Rejected by the schema</span> - <span style="color:#924c9d;">True</span><span style="font-weight:bold;">,</span> <span style="color:#924c9d;">Null</span><span style="font-weight:bold;">,</span> <span style="color:#b08000;">0o7</span><span style="font-weight:bold;">,</span> <span style="color:#b08000;">0x3A</span><span style="font-weight:bold;">,</span> <span style="color:#b08000;">+12.3</span><span style="font-weight:bold;">,</span> - <span style="font-weight:bold;">],</span> +<span style="color:#006e28;">!!map</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">{</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">!!str "Booleans"</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">!!seq</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span> +<span style="color:#0057ae;"> </span><span style="color:#006e28;">!!bool</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"true"</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">!!bool</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"false"</span> +<span style="color:#0057ae;"> </span><span style="font-weight:bold;">],</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">!!str "Invalid"</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">!!seq</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span> +<span style="color:#898887;"> # Rejected by the schema</span> +<span style="color:#0057ae;"> </span><span style="color:#924c9d;">True</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;">Null</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">0o7</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">0x3A</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">+12.3</span><span style="font-weight:bold;">,</span> +<span style="color:#0057ae;"> </span><span style="font-weight:bold;">],</span> <span style="font-weight:bold;">}</span> <span style="color:#006e28;">--- !clarkevans.com,2002/graph/^shape</span> -<span style="font-weight:bold;">-</span> !^circle - <span style="color:#644a9b;">center:</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">&ORIGIN</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">{</span><span style="color:#644a9b;">x:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">73</span><span style="font-weight:bold;">,</span> <span style="color:#644a9b;">y:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">129</span><span style="font-weight:bold;">}</span> - <span style="color:#644a9b;">radius:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">7</span> +<span style="font-weight:bold;">-</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">!^circle</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">center</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#006e28;">&ORIGIN</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">{</span><span style="color:#644a9b;font-weight:bold;">x</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">73</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">y</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">129</span><span style="font-weight:bold;">}</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">radius</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">7</span> -<span style="font-weight:bold;">?</span> <span style="font-weight:bold;">-</span> Dog - <span style="font-weight:bold;">-</span> Cat -<span style="color:#644a9b;">:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span> 2018-08-11<span style="font-weight:bold;">,</span> 2016-01-01 <span style="font-weight:bold;">]</span> +<span style="font-weight:bold;">?</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">-</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">Dog</span> +<span style="color:#0057ae;"> </span><span style="font-weight:bold;">-</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">Cat</span> +<span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span><span style="color:#0057ae;"> 2018-08-11</span><span style="font-weight:bold;">,</span><span style="color:#0057ae;"> 2016-01-01 </span><span style="font-weight:bold;">]</span> <span style="color:#898887;"># Literal/Folded Style</span> -<span style="color:#006e28;">--- </span><span style="color:#bf0303;font-weight:bold;">|</span> +<span style="color:#006e28;">--- </span><span style="color:#924c9d;font-weight:bold;">|</span> \//||\/|| // || ||__ -<span style="color:#006e28;">--- </span><span style="color:#bf0303;font-weight:bold;">></span> +<span style="color:#006e28;">--- </span><span style="color:#924c9d;font-weight:bold;">></span> Mark McGwire's year was crippled by a knee injury. -<span style="font-weight:bold;">? </span><span style="color:#bf0303;font-weight:bold;">|</span> +<span style="font-weight:bold;">? </span><span style="color:#924c9d;font-weight:bold;">|</span> This is a key that has multiple lines -<span style="color:#644a9b;">:</span> <span style="color:#bf0303;font-weight:bold;">|</span> +<span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;font-weight:bold;">|</span> and this is it's literal value <span style="color:#898887;"># Capture the indentation of the Key. The "-" and "?" operators</span> <span style="color:#898887;"># are considered as part of the indentation:</span> -<span style="color:#644a9b;">key1:</span> -<span style="color:#644a9b;"> key2:</span> <span style="color:#0057ae;">!!hello</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;font-weight:bold;">|</span> +<span style="color:#644a9b;font-weight:bold;">key1</span><span style="font-weight:bold;">:</span> +<span style="color:#644a9b;font-weight:bold;"> key2</span><span style="font-weight:bold;">: </span><span style="color:#006e28;">!!hello</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;font-weight:bold;">|</span> literal: " text" # [ ] # literal { } -<span style="color:#644a9b;"> key3:</span> <span style="color:#bf0303;font-weight:bold;">|+</span> +<span style="color:#644a9b;font-weight:bold;"> key3</span><span style="font-weight:bold;">: </span><span style="color:#924c9d;font-weight:bold;">|+</span> literal: 'text' - <span style="color:#644a9b;">no-literal:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">" text"</span> - <span style="color:#898887;">#comment</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">no-literal</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">" text"</span> +<span style="color:#898887;"> #comment</span> -<span style="font-weight:bold;">? </span><span style="color:#644a9b;">key:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;font-weight:bold;">|-</span> +<span style="font-weight:bold;">? </span><span style="color:#644a9b;font-weight:bold;">key</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;font-weight:bold;">|-</span> literal: "text" - <span style="color:#644a9b;">no-literal:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"text"</span> -<span style="font-weight:bold;">-</span> item1 - <span style="font-weight:bold;">-</span> item2 -<span style="font-weight:bold;"> - - - </span><span style="color:#644a9b;">key:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;font-weight:bold;">>-</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">no-literal</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"text"</span> +<span style="font-weight:bold;">-</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">item1</span> +<span style="color:#0057ae;"> </span><span style="font-weight:bold;">-</span><span style="color:#0057ae;"> </span><span style="color:#0057ae;">item2</span> +<span style="font-weight:bold;"> - - - </span><span style="color:#644a9b;font-weight:bold;">key</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;font-weight:bold;">>-</span> "literal text" # [ ] 'literal block' - <span style="color:#644a9b;">no-literal:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">12</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">no-literal</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#b08000;">12</span> -<span style="font-weight:bold;">? - - - - ? </span><span style="color:#644a9b;">key:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;font-weight:bold;">|</span> +<span style="font-weight:bold;">? - - - - ? </span><span style="color:#644a9b;font-weight:bold;">key</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;font-weight:bold;">|</span> literal: [ ] - <span style="color:#644a9b;">no-literal:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span> <span style="font-weight:bold;">]</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">no-literal</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">[</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">]</span> <span style="color:#898887;"># Capture the indentation of the literal/folded operator:</span> -<span style="color:#bf0303;font-weight:bold;">|-</span> +<span style="color:#924c9d;font-weight:bold;">|-</span> literal: "text" -<span style="color:#0057ae;">!!binary</span> <span style="color:#bf0303;font-weight:bold;">|</span> +<span style="color:#006e28;">!!binary</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;font-weight:bold;">|</span> R0lGODlhDAAMAIQAAP//9/X 17unp5WZmZgAAAOfn515eXv Pz7Y6OjuDg4J+fn5OTk6enp 56enmleECcgggoBADs= -<span style="color:#644a9b;">key1:</span> - <span style="color:#644a9b;">key2:</span> -<span style="color:#bf0303;font-weight:bold;"> |</span> +<span style="color:#644a9b;font-weight:bold;">key1</span><span style="font-weight:bold;">:</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">key2</span><span style="font-weight:bold;">:</span> +<span style="color:#924c9d;font-weight:bold;"> |</span> literal: "text" - <span style="color:#644a9b;">key3:</span> -<span style="color:#0057ae;"> !!str</span> <span style="color:#bf0303;font-weight:bold;">|</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">key3</span><span style="font-weight:bold;">:</span> +<span style="color:#006e28;"> !!str</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;font-weight:bold;">|</span> literal: "text" #literal <span style="color:#898887;"># Capture the indentation of the operators "-" or "?":</span> -<span style="font-weight:bold;">? - - - </span><span style="color:#0057ae;">!!hello</span> <span style="color:#bf0303;font-weight:bold;">|+</span> +<span style="font-weight:bold;">? - - - </span><span style="color:#006e28;">!!hello</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;font-weight:bold;">|+</span> literal: "sdfsd" # [ ] - <span style="color:#644a9b;">no-literal:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"sdfsd"</span> <span style="color:#898887;"># [ ]</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">no-literal</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"sdfsd"</span><span style="color:#898887;"> # [ ]</span> -<span style="font-weight:bold;">- - - - </span><span style="color:#bf0303;font-weight:bold;">>-</span> +<span style="font-weight:bold;">- - - - </span><span style="color:#924c9d;font-weight:bold;">>-</span> literal: "text" #literal - <span style="color:#644a9b;">no-literal:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"text"</span> +<span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">no-literal</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#bf0303;">"text"</span><span style="color:#0057ae;"> </span> <span style="color:#898887;"># This implementation of literal blocks has a limitation:</span> <span style="color:#898887;"># it only supports 6 dashes at most.</span> -<span style="font-weight:bold;">-</span> <span style="font-weight:bold;">-</span> <span style="font-weight:bold;">-</span> <span style="font-weight:bold;">-</span> <span style="font-weight:bold;">-</span> <span style="font-weight:bold;">-</span> <span style="font-weight:bold;">-</span> <span style="color:#644a9b;">key:</span><span style="color:#0057ae;"> |</span> - literal? <span style="color:#bf0303;">"dfsf"</span> +<span style="font-weight:bold;">-</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">-</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">-</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">-</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">-</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">-</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">-</span><span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">key</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="color:#924c9d;font-weight:bold;">|</span> +<span style="color:#0057ae;"> literal? "dfsf"</span> + +<span style="color:#898887;"># Only comments after spaces & strings in multiline attributes (bug #407060)</span> +<span style="color:#644a9b;font-weight:bold;">reg_list</span><span style="font-weight:bold;">:</span> +<span style="font-weight:bold;">-</span><span style="color:#0057ae;"> </span><span style="color:#644a9b;font-weight:bold;">reg</span><span style="font-weight:bold;">:</span><span style="color:#0057ae;"> </span><span style="font-weight:bold;">?</span><span style="color:#0057ae;">#XPath //div[@class="product_item cf"][@id] ))(?sx)</span> +<span style="color:#0057ae;"> id="product(?P<code>[^"]+)"</span> +<span style="color:#0057ae;"> .+?<h4><a\s+[^>]+>(?P<title>[^<]+)</a></h4></span> </pre></body></html> diff --git a/autotests/input/test.yaml b/autotests/input/test.yaml --- a/autotests/input/test.yaml +++ b/autotests/input/test.yaml @@ -149,3 +149,9 @@ # it only supports 6 dashes at most. - - - - - - - key: | literal? "dfsf" + +# Only comments after spaces & strings in multiline attributes (bug #407060) +reg_list: +- reg: ?#XPath //div[@class="product_item cf"][@id] ))(?sx) + id="product(?P<code>[^"]+)" + .+?<h4><a\s+[^>]+>(?P<title>[^<]+)</a></h4> diff --git a/autotests/reference/example.rmd.ref b/autotests/reference/example.rmd.ref --- a/autotests/reference/example.rmd.ref +++ b/autotests/reference/example.rmd.ref @@ -1,8 +1,8 @@ <Markdown>---</Markdown><br/> -<Key>title:</Key><Attribute> </Attribute><String>"test"</String><br/> -<Key>author:</Key><Attribute> </Attribute><String>"me"</String><br/> -<Key>date:</Key><Attribute> </Attribute><String>"07.10.2014"</String><br/> -<Key>output:</Key><Attribute> html_document</Attribute><br/> +<Key>title</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><String>"test"</String><br/> +<Key>author</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><String>"me"</String><br/> +<Key>date</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><String>"07.10.2014"</String><br/> +<Key>output</Key><Key Points Operator>:</Key Points Operator><Attribute> html_document</Attribute><br/> <Markdown>---</Markdown><br/> <Normal Text></Normal Text><br/> <Normal Text>This is a simple test document. It shows syntax highlighting switches between YAML (above), R blocks</Normal Text><br/> diff --git a/autotests/reference/test.yaml.ref b/autotests/reference/test.yaml.ref --- a/autotests/reference/test.yaml.ref +++ b/autotests/reference/test.yaml.ref @@ -1,79 +1,79 @@ <Comment># YAML test</Comment><br/> -<Normal Text></Normal Text><br/> +<Attribute></Attribute><br/> <Comment># Comment</Comment><br/> -<Normal Text></Normal Text><br/> -<Key>key:</Key><Attribute> value</Attribute><br/> -<Key>another key:</Key><Attribute> Another value</Attribute><br/> -<Key>boolean:</Key><Attribute> </Attribute><Boolean>true</Boolean><br/> -<Key>null_value:</Key><Attribute> </Attribute><Null>null</Null><br/> -<Key>single quotes:</Key><Attribute> </Attribute><String>'have </String><Escaped Character>''</Escaped Character><String>one</String><Escaped Character>''</Escaped Character><String> escape pattern'</String><br/> -<Key>double quotes:</Key><Attribute> </Attribute><String>"have many: </String><Escaped Character>\"</Escaped Character><String>, </String><Escaped Character>\0</Escaped Character><String>, </String><Escaped Character>\t</Escaped Character><String>, </String><Escaped Character>\u263A</Escaped Character><String>, </String><Escaped Character>\x0d\x0a</Escaped Character><String> == </String><Escaped Character>\r\n</Escaped Character><String>, and more."</String><br/> -<Normal Text></Normal Text><br/> -<Key>decimal:</Key><Attribute> </Attribute><Integer>+12345</Integer><br/> -<Key>negative:</Key><Attribute> </Attribute><Integer>-1_4</Integer><br/> -<Key>zero:</Key><Attribute> </Attribute><Integer>0</Integer><br/> -<Key>octal:</Key><Attribute> </Attribute><Integer>0o14</Integer><br/> -<Key>another octal:</Key><Attribute> </Attribute><Integer>014_2</Integer><br/> -<Key>hexadecimal:</Key><Attribute> </Attribute><Integer>0x_Ca2</Integer><br/> -<Key>float:</Key><Attribute> </Attribute><Float>1.23015e+3</Float><br/> -<Key>exponential:</Key><Attribute> </Attribute><Float>12.3015e+02</Float><br/> -<Key>fixed:</Key><Attribute> </Attribute><Float>12__30.1_5</Float><br/> -<Key>sexagesimal:</Key><Attribute> </Attribute><Float>19_0:20:30.15</Float><br/> -<Key>sexagesimal-inline:</Key><Attribute> </Attribute><Operator>[</Operator><Integer>123:45:12</Integer><Operator>,</Operator><List> </List><Float>123:45:32.234_32</Float><Operator>,</Operator><List> </List><Integer>+12__3:23</Integer><Operator>]</Operator><br/> -<Key>infinity:</Key><Attribute> </Attribute><Data Types>!!float</Data Types><Attribute> </Attribute><Float>.inf</Float><br/> -<Key>not a number:</Key><Attribute> </Attribute><Data Types>!!float</Data Types><Attribute> </Attribute><Float>.NaN</Float><br/> -<Key>datetime:</Key><Attribute> 2001-12-15T02:59:43.1Z</Attribute><br/> -<Key>date:</Key><Attribute> 2002-12-14</Attribute><br/> -<Normal Text></Normal Text><br/> -<Key>json_map:</Key><Attribute> </Attribute><Operator>{</Operator><Key>"key":</Key><Attribute> </Attribute><String>"value"</String><Operator>}</Operator><br/> -<Key>json_seq:</Key><Attribute> </Attribute><Operator>[</Operator><Integer>3</Integer><Operator>,</Operator><List> </List><Integer>2</Integer><Operator>,</Operator><List> </List><Float>-.inf</Float><Operator>,</Operator><List> </List><String>"value"</String><Operator>]</Operator><br/> -<Key>another key:</Key><Attribute> </Attribute><Operator>{</Operator><Key>key:</Key><Attribute> </Attribute><Operator>[</Operator><Integer>+0x12a</Integer><Operator>,</Operator><List> </List><Operator>,</Operator><List> </List><Key>!!hello:</Key><Attribute> bye</Attribute><Operator>,</Operator><List> </List><Integer>1</Integer><Operator>,</Operator><List> </List><Boolean>off</Boolean><Operator>,</Operator><List> </List><Operator>{</Operator><Key>a:</Key><Attribute> </Attribute><Operator>[{</Operator><Key>b:</Key><Attribute> </Attribute><String>''</String><Operator>}]}]}</Operator><br/> -<Normal Text></Normal Text><br/> +<Attribute></Attribute><br/> +<Key>key</Key><Key Points Operator>:</Key Points Operator><Attribute> value</Attribute><br/> +<Key>another key</Key><Key Points Operator>:</Key Points Operator><Attribute> Another value</Attribute><br/> +<Key>boolean</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Boolean>true</Boolean><br/> +<Key>null_value</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Null>null</Null><br/> +<Key>single quotes</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><String>'have </String><Escaped Character>''</Escaped Character><String>one</String><Escaped Character>''</Escaped Character><String> escape pattern'</String><br/> +<Key>double quotes</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><String>"have many: </String><Escaped Character>\"</Escaped Character><String>, </String><Escaped Character>\0</Escaped Character><String>, </String><Escaped Character>\t</Escaped Character><String>, </String><Escaped Character>\u263A</Escaped Character><String>, </String><Escaped Character>\x0d\x0a</Escaped Character><String> == </String><Escaped Character>\r\n</Escaped Character><String>, and more."</String><br/> +<Attribute></Attribute><br/> +<Key>decimal</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Integer>+12345</Integer><br/> +<Key>negative</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Integer>-1_4</Integer><br/> +<Key>zero</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Integer>0</Integer><br/> +<Key>octal</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Integer>0o14</Integer><br/> +<Key>another octal</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Integer>014_2</Integer><br/> +<Key>hexadecimal</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Integer>0x_Ca2</Integer><br/> +<Key>float</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Float>1.23015e+3</Float><br/> +<Key>exponential</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Float>12.3015e+02</Float><br/> +<Key>fixed</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Float>12__30.1_5</Float><br/> +<Key>sexagesimal</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Float>19_0:20:30.15</Float><br/> +<Key>sexagesimal-inline</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Operator>[</Operator><Integer>123:45:12</Integer><Operator>,</Operator><List> </List><Float>123:45:32.234_32</Float><Operator>,</Operator><List> </List><Integer>+12__3:23</Integer><Operator>]</Operator><br/> +<Key>infinity</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Data Types>!!float</Data Types><Attribute> </Attribute><Float>.inf</Float><br/> +<Key>not a number</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Data Types>!!float</Data Types><Attribute> </Attribute><Float>.NaN</Float><br/> +<Key>datetime</Key><Key Points Operator>:</Key Points Operator><Attribute> 2001-12-15T02:59:43.1Z</Attribute><br/> +<Key>date</Key><Key Points Operator>:</Key Points Operator><Attribute> 2002-12-14</Attribute><br/> +<Attribute></Attribute><br/> +<Key>json_map</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Operator>{</Operator><Key>"key"</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><String>"value"</String><Operator>}</Operator><br/> +<Key>json_seq</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Operator>[</Operator><Integer>3</Integer><Operator>,</Operator><List> </List><Integer>2</Integer><Operator>,</Operator><List> </List><Float>-.inf</Float><Operator>,</Operator><List> </List><String>"value"</String><Operator>]</Operator><br/> +<Key>another key</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Operator>{</Operator><Key>key</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Operator>[</Operator><Integer>+0x12a</Integer><Operator>,</Operator><List> </List><Operator>,</Operator><List> </List><Key>!!hello</Key><Key Points Operator>:</Key Points Operator><Attribute> bye</Attribute><Operator>,</Operator><List> </List><Integer>1</Integer><Operator>,</Operator><List> </List><Boolean>off</Boolean><Operator>,</Operator><List> </List><Operator>{</Operator><Key>a</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Operator>[{</Operator><Key>b</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><String>''</String><Operator>}]}]}</Operator><br/> +<Attribute></Attribute><br/> <Operator>?</Operator><Normal Text> </Normal Text><Data Types>!!python/tuple</Data Types><Normal Text> </Normal Text><Operator>[</Operator><Integer>5</Integer><Operator>,</Operator><List> </List><Integer>7</Integer><Operator>]</Operator><br/> -<Key>:</Key><Attribute> Fifty Seven</Attribute><br/> -<Normal Text></Normal Text><br/> -<Operator>?</Operator><Normal Text> </Normal Text><Key>set2:</Key><br/> -<Normal Text> </Normal Text><Key>item1:</Key><Attribute> </Attribute><Null>null</Null><br/> -<Normal Text> </Normal Text><Key>item2:</Key><Attribute> </Attribute><Null>null</Null><br/> -<Normal Text></Normal Text><br/> -<Key>foo:</Key><Attribute> </Attribute><Alias>&foo</Alias><br/> -<Normal Text> </Normal Text><Key><<:</Key><Attribute> </Attribute><Reference>*base</Reference><br/> -<Normal Text> </Normal Text><Key>age:</Key><Attribute> </Attribute><Integer>10</Integer><br/> -<Normal Text></Normal Text><br/> +<Key Points Operator>:</Key Points Operator><Attribute> Fifty Seven</Attribute><br/> +<Attribute></Attribute><br/> +<Operator>?</Operator><Normal Text> </Normal Text><Key>set2</Key><Key Points Operator>:</Key Points Operator><br/> +<Attribute> </Attribute><Key>item1</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Null>null</Null><br/> +<Attribute> </Attribute><Key>item2</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Null>null</Null><br/> +<Attribute></Attribute><br/> +<Key>foo</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Alias>&foo</Alias><br/> +<Attribute> </Attribute><Key><<</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Reference>*base</Reference><br/> +<Attribute> </Attribute><Key>age</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Integer>10</Integer><br/> +<Attribute></Attribute><br/> <Data Types>!!seq</Data Types><Normal Text> </Normal Text><Operator>[</Operator><br/> <List> </List><Data Types>!!str</Data Types><List> </List><String>"Block scalar</String><Escaped Character>\n</Escaped Character><String>"</String><Operator>,</Operator><br/> <List> </List><Data Types>!!map</Data Types><List> </List><Operator>{</Operator><br/> <Hash> </Hash><Operator>?</Operator><Hash> </Hash><Alias>&B1</Alias><Hash> </Hash><Data Types>!!str</Data Types><Hash> </Hash><String>"foo"</String><br/> -<Hash> </Hash><Key>:</Key><Attribute> </Attribute><Data Types>!!str</Data Types><Attribute> </Attribute><String>"bar"</String><Operator>,</Operator><br/> +<Hash> </Hash><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Data Types>!!str</Data Types><Attribute> </Attribute><String>"bar"</String><Operator>,</Operator><br/> <Hash> </Hash><Operator>?</Operator><Hash> </Hash><Data Types>!!str</Data Types><Hash> </Hash><String>"baz"</String><br/> -<Hash> </Hash><Key>:</Key><Attribute> </Attribute><Reference>*B1,</Reference><br/> +<Hash> </Hash><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Reference>*B1,</Reference><br/> <Attribute> </Attribute><Operator>},</Operator><br/> <List> </List><Data Types>!!map</Data Types><List> </List><Operator>{</Operator><br/> -<Hash> </Hash><Key>!!str "sun" :</Key><Attribute> </Attribute><Data Types>!!str</Data Types><Attribute> </Attribute><String>"yellow"</String><Operator>,</Operator><br/> +<Hash> </Hash><Key>!!str "sun" </Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Data Types>!!str</Data Types><Attribute> </Attribute><String>"yellow"</String><Operator>,</Operator><br/> <Hash> </Hash><Operator>},</Operator><br/> <Operator>]</Operator><br/> -<Normal Text></Normal Text><br/> +<Attribute></Attribute><br/> <Data Types>!!map</Data Types><Normal Text> </Normal Text><Operator>{</Operator><br/> -<Hash> </Hash><Key>!!str "Booleans":</Key><Attribute> </Attribute><Data Types>!!seq</Data Types><Attribute> </Attribute><Operator>[</Operator><br/> +<Hash> </Hash><Key>!!str "Booleans"</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Data Types>!!seq</Data Types><Attribute> </Attribute><Operator>[</Operator><br/> <List> </List><Data Types>!!bool</Data Types><List> </List><String>"true"</String><Operator>,</Operator><List> </List><Data Types>!!bool</Data Types><List> </List><String>"false"</String><br/> <List> </List><Operator>],</Operator><br/> -<Hash> </Hash><Key>!!str "Invalid":</Key><Attribute> </Attribute><Data Types>!!seq</Data Types><Attribute> </Attribute><Operator>[</Operator><br/> -<List> </List><Comment># Rejected by the schema</Comment><br/> +<Hash> </Hash><Key>!!str "Invalid"</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Data Types>!!seq</Data Types><Attribute> </Attribute><Operator>[</Operator><br/> +<Comment> # Rejected by the schema</Comment><br/> <List> </List><Boolean>True</Boolean><Operator>,</Operator><List> </List><Null>Null</Null><Operator>,</Operator><List> </List><Integer>0o7</Integer><Operator>,</Operator><List> </List><Integer>0x3A</Integer><Operator>,</Operator><List> </List><Float>+12.3</Float><Operator>,</Operator><br/> <List> </List><Operator>],</Operator><br/> <Operator>}</Operator><br/> -<Normal Text></Normal Text><br/> +<Attribute></Attribute><br/> <Document Header>--- !clarkevans.com,2002/graph/^shape</Document Header><br/> -<Operator>-</Operator><List> </List><Normal Text>!^circle</Normal Text><br/> -<Normal Text> </Normal Text><Key>center:</Key><Attribute> </Attribute><Alias>&ORIGIN</Alias><Attribute> </Attribute><Operator>{</Operator><Key>x:</Key><Attribute> </Attribute><Integer>73</Integer><Operator>,</Operator><Hash> </Hash><Key>y:</Key><Attribute> </Attribute><Integer>129</Integer><Operator>}</Operator><br/> -<Normal Text> </Normal Text><Key>radius:</Key><Attribute> </Attribute><Integer>7</Integer><br/> -<Normal Text></Normal Text><br/> -<Operator>?</Operator><Normal Text> </Normal Text><Operator>-</Operator><List> </List><Normal Text>Dog</Normal Text><br/> -<Normal Text> </Normal Text><Operator>-</Operator><List> </List><Normal Text>Cat</Normal Text><br/> -<Key>:</Key><Attribute> </Attribute><Operator>[</Operator><List> 2018-08-11</List><Operator>,</Operator><List> 2016-01-01 </List><Operator>]</Operator><br/> -<Normal Text></Normal Text><br/> +<Operator>-</Operator><Normal Text> </Normal Text><Attribute>!^circle</Attribute><br/> +<Attribute> </Attribute><Key>center</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Alias>&ORIGIN</Alias><Attribute> </Attribute><Operator>{</Operator><Key>x</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Integer>73</Integer><Operator>,</Operator><Hash> </Hash><Key>y</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Integer>129</Integer><Operator>}</Operator><br/> +<Attribute> </Attribute><Key>radius</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Integer>7</Integer><br/> +<Attribute></Attribute><br/> +<Operator>?</Operator><Normal Text> </Normal Text><Operator>-</Operator><Normal Text> </Normal Text><Attribute>Dog</Attribute><br/> +<Attribute> </Attribute><Operator>-</Operator><Normal Text> </Normal Text><Attribute>Cat</Attribute><br/> +<Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Operator>[</Operator><List> 2018-08-11</List><Operator>,</Operator><List> 2016-01-01 </List><Operator>]</Operator><br/> +<Attribute></Attribute><br/> <Comment># Literal/Folded Style</Comment><br/> -<Normal Text></Normal Text><br/> +<Attribute></Attribute><br/> <Document Header>--- </Document Header><Literal/Folded Operator>|</Literal/Folded Operator><br/> <Literal/Folded Block> \//||\/||</Literal/Folded Block><br/> <Literal/Folded Block> // || ||__</Literal/Folded Block><br/> @@ -86,36 +86,36 @@ <Operator>? </Operator><Literal/Folded Operator>|</Literal/Folded Operator><br/> <Literal/Folded Block> This is a key</Literal/Folded Block><br/> <Literal/Folded Block> that has multiple lines</Literal/Folded Block><br/> -<Key>:</Key><Normal Text> </Normal Text><Literal/Folded Operator>|</Literal/Folded Operator><br/> +<Key Points Operator>:</Key Points Operator><Normal Text> </Normal Text><Literal/Folded Operator>|</Literal/Folded Operator><br/> <Literal/Folded Block> and this is it's literal value</Literal/Folded Block><br/> <Normal Text></Normal Text><br/> <Comment># Capture the indentation of the Key. The "-" and "?" operators</Comment><br/> <Comment># are considered as part of the indentation:</Comment><br/> -<Key>key1:</Key><br/> -<Key> key2:</Key><Normal Text> </Normal Text><Data Types>!!hello</Data Types><Attribute> </Attribute><Literal/Folded Operator>|</Literal/Folded Operator><br/> +<Key>key1</Key><Key Points Operator>:</Key Points Operator><br/> +<Key> key2</Key><Key Points Operator>: </Key Points Operator><Data Types>!!hello</Data Types><Attribute> </Attribute><Literal/Folded Operator>|</Literal/Folded Operator><br/> <Literal/Folded Block> literal: " text" # [ ]</Literal/Folded Block><br/> <Normal Text></Normal Text><br/> <Literal/Folded Block> # literal { }</Literal/Folded Block><br/> -<Key> key3:</Key><Normal Text> </Normal Text><Literal/Folded Operator>|+</Literal/Folded Operator><br/> +<Key> key3</Key><Key Points Operator>: </Key Points Operator><Literal/Folded Operator>|+</Literal/Folded Operator><br/> <Literal/Folded Block> literal: 'text'</Literal/Folded Block><br/> -<Normal Text> </Normal Text><Key>no-literal:</Key><Attribute> </Attribute><String>" text"</String><br/> -<Normal Text> </Normal Text><Comment>#comment</Comment><br/> -<Normal Text></Normal Text><br/> -<Operator>? </Operator><Key>key:</Key><Attribute> </Attribute><Literal/Folded Operator>|-</Literal/Folded Operator><br/> +<Attribute> </Attribute><Key>no-literal</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><String>" text"</String><br/> +<Comment> #comment</Comment><br/> +<Attribute></Attribute><br/> +<Operator>? </Operator><Key>key</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Literal/Folded Operator>|-</Literal/Folded Operator><br/> <Literal/Folded Block> literal: "text"</Literal/Folded Block><br/> -<Normal Text> </Normal Text><Key>no-literal:</Key><Attribute> </Attribute><String>"text"</String><br/> -<Operator>-</Operator><List> </List><Normal Text>item1</Normal Text><br/> -<Normal Text> </Normal Text><Operator>-</Operator><List> </List><Normal Text>item2</Normal Text><br/> -<Operator> - - - </Operator><Key>key:</Key><Attribute> </Attribute><Literal/Folded Operator>>-</Literal/Folded Operator><br/> +<Attribute> </Attribute><Key>no-literal</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><String>"text"</String><br/> +<Operator>-</Operator><Normal Text> </Normal Text><Attribute>item1</Attribute><br/> +<Attribute> </Attribute><Operator>-</Operator><Normal Text> </Normal Text><Attribute>item2</Attribute><br/> +<Operator> - - - </Operator><Key>key</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Literal/Folded Operator>>-</Literal/Folded Operator><br/> <Literal/Folded Block> "literal text" # [ ]</Literal/Folded Block><br/> <Normal Text></Normal Text><br/> <Literal/Folded Block> 'literal block'</Literal/Folded Block><br/> -<Normal Text> </Normal Text><Key>no-literal:</Key><Attribute> </Attribute><Integer>12</Integer><br/> -<Normal Text></Normal Text><br/> -<Operator>? - - - - ? </Operator><Key>key:</Key><Attribute> </Attribute><Literal/Folded Operator>|</Literal/Folded Operator><br/> +<Attribute> </Attribute><Key>no-literal</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Integer>12</Integer><br/> +<Attribute></Attribute><br/> +<Operator>? - - - - ? </Operator><Key>key</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Literal/Folded Operator>|</Literal/Folded Operator><br/> <Literal/Folded Block> literal: [ ]</Literal/Folded Block><br/> -<Normal Text> </Normal Text><Key>no-literal:</Key><Attribute> </Attribute><Operator>[</Operator><List> </List><Operator>]</Operator><br/> -<Normal Text></Normal Text><br/> +<Attribute> </Attribute><Key>no-literal</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Operator>[</Operator><List> </List><Operator>]</Operator><br/> +<Attribute></Attribute><br/> <Comment># Capture the indentation of the literal/folded operator:</Comment><br/> <Literal/Folded Operator>|-</Literal/Folded Operator><br/> <Literal/Folded Block> literal: "text"</Literal/Folded Block><br/> @@ -126,26 +126,32 @@ <Literal/Folded Block> Pz7Y6OjuDg4J+fn5OTk6enp</Literal/Folded Block><br/> <Literal/Folded Block> 56enmleECcgggoBADs=</Literal/Folded Block><br/> <Normal Text></Normal Text><br/> -<Key>key1:</Key><br/> -<Normal Text> </Normal Text><Key>key2:</Key><br/> +<Key>key1</Key><Key Points Operator>:</Key Points Operator><br/> +<Attribute> </Attribute><Key>key2</Key><Key Points Operator>:</Key Points Operator><br/> <Literal/Folded Operator> |</Literal/Folded Operator><br/> <Literal/Folded Block> literal: "text"</Literal/Folded Block><br/> -<Normal Text> </Normal Text><Key>key3:</Key><br/> +<Attribute> </Attribute><Key>key3</Key><Key Points Operator>:</Key Points Operator><br/> <Data Types> !!str</Data Types><Normal Text> </Normal Text><Literal/Folded Operator>|</Literal/Folded Operator><br/> <Literal/Folded Block> literal: "text"</Literal/Folded Block><br/> <Literal/Folded Block> #literal</Literal/Folded Block><br/> <Normal Text></Normal Text><br/> <Comment># Capture the indentation of the operators "-" or "?":</Comment><br/> -<Operator>? - - - </Operator><Data Types>!!hello</Data Types><Normal Text> </Normal Text><Literal/Folded Operator>|+</Literal/Folded Operator><br/> +<Operator>? - - - </Operator><Data Types>!!hello</Data Types><Attribute> </Attribute><Literal/Folded Operator>|+</Literal/Folded Operator><br/> <Literal/Folded Block> literal: "sdfsd" # [ ]</Literal/Folded Block><br/> -<Normal Text> </Normal Text><Key>no-literal:</Key><Attribute> </Attribute><String>"sdfsd"</String><Normal Text> </Normal Text><Comment># [ ]</Comment><br/> -<Normal Text></Normal Text><br/> +<Attribute> </Attribute><Key>no-literal</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><String>"sdfsd"</String><Comment> # [ ]</Comment><br/> +<Attribute></Attribute><br/> <Operator>- - - - </Operator><Literal/Folded Operator>>-</Literal/Folded Operator><br/> <Literal/Folded Block> literal: "text"</Literal/Folded Block><br/> <Literal/Folded Block> #literal</Literal/Folded Block><br/> -<Normal Text> </Normal Text><Key>no-literal:</Key><Attribute> </Attribute><String>"text"</String><Normal Text> </Normal Text><br/> -<Normal Text></Normal Text><br/> +<Attribute> </Attribute><Key>no-literal</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><String>"text"</String><Normal Text> </Normal Text><br/> +<Attribute></Attribute><br/> <Comment># This implementation of literal blocks has a limitation:</Comment><br/> <Comment># it only supports 6 dashes at most.</Comment><br/> -<Operator>-</Operator><List> </List><Operator>-</Operator><List> </List><Operator>-</Operator><List> </List><Operator>-</Operator><List> </List><Operator>-</Operator><List> </List><Operator>-</Operator><List> </List><Operator>-</Operator><List> </List><Key>key:</Key><Attribute> |</Attribute><br/> -<Normal Text> literal? </Normal Text><String>"dfsf"</String><br/> +<Operator>-</Operator><Normal Text> </Normal Text><Operator>-</Operator><Normal Text> </Normal Text><Operator>-</Operator><Normal Text> </Normal Text><Operator>-</Operator><Normal Text> </Normal Text><Operator>-</Operator><Normal Text> </Normal Text><Operator>-</Operator><Normal Text> </Normal Text><Operator>-</Operator><Normal Text> </Normal Text><Key>key</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Literal/Folded Operator>|</Literal/Folded Operator><br/> +<Attribute> literal? "dfsf"</Attribute><br/> +<Attribute></Attribute><br/> +<Comment># Only comments after spaces & strings in multiline attributes (bug #407060)</Comment><br/> +<Key>reg_list</Key><Key Points Operator>:</Key Points Operator><br/> +<Operator>-</Operator><Normal Text> </Normal Text><Key>reg</Key><Key Points Operator>:</Key Points Operator><Attribute> </Attribute><Operator>?</Operator><Attribute>#XPath //div[@class="product_item cf"][@id] ))(?sx)</Attribute><br/> +<Attribute> id="product(?P<code>[^"]+)"</Attribute><br/> +<Attribute> .+?<h4><a\s+[^>]+>(?P<title>[^<]+)</a></h4></Attribute><br/> diff --git a/data/syntax/yaml.xml b/data/syntax/yaml.xml --- a/data/syntax/yaml.xml +++ b/data/syntax/yaml.xml @@ -27,70 +27,104 @@ <!ENTITY literalOp "[\|>][\-\+]?"> <!-- Key after "?" or "-", used to detect literal/folded operator --> <!ENTITY keyAfterOp "(?:[^"'#\-\?\s][^:#]*|\-(?:[^\s:#][^:#]*)?|&keyDQ;|&keySQ;)"> + + <!ENTITY dataTypes "!!\S+"> + <!ENTITY alias "&\S+"> + <!ENTITY reference "\*\S+"> ]> <!-- Author: Dr Orlovsky MA <maxim@orlovsky.info> //--> -<!-- Modifications, values & support for literal/folded style: - Nibaldo González S. <nibgonz@gmail.com> //--> -<language name="YAML" version="5" kateversion="5.0" section="Markup" - extensions="*.yaml;*.yml" mimetype="text/yaml" - author="Dr Orlovsky MA (dr.orlovsky@gmail.com)" license="LGPL"> +<!-- Modifications (YAML 1.2), values & support for literal/folded style: + Nibaldo González S. <nibgonz@gmail.com> + These modifications are under the MIT license. //--> +<language name="YAML" version="6" kateversion="5.0" section="Markup" + extensions="*.yaml;*.yml" mimetype="text/yaml" priority="9" + author="Dr Orlovsky MA (dr.orlovsky@gmail.com), Nibaldo González (nibgonz@gmail.com)" license="LGPL"> <highlighting> <contexts> - <context attribute="Normal Text" lineEndContext="#stay" name="normal" > + <context attribute="Attribute" lineEndContext="#stay" name="normal" > <StringDetect attribute="Document Header" context="header" String="---" column="0"/> - <RegExpr attribute="End of Document" context="EOD" String="^\.\.\.$"/> + <RegExpr attribute="End of Document" context="EOD" String="^\.\.\.$" column="0"/> <DetectChar attribute="Directive" context="directive" char="%" column="0"/> - <DetectChar attribute="Comment" context="comment" char="#" /> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> <!-- Literal/Folded Style --> <IncludeRules context="find-literal-block" /> <RegExpr attribute="Operator" firstNonSpace="true" context="dash" String="\-(?=\s|$)" /> <DetectChar attribute="Operator" firstNonSpace="true" context="mapping-key" char="?" /> - <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" /> - <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" /> + <DetectChar attribute="Operator" firstNonSpace="true" context="list" char="[" beginRegion="List" /> + <DetectChar attribute="Operator" firstNonSpace="true" context="hash" char="{" beginRegion="Hash" /> - <RegExpr attribute="Data Types" firstNonSpace="true" context="#stay" String="!!\S+" /> - <RegExpr attribute="Alias" firstNonSpace="true" context="#stay" String="&\S+" /> - <RegExpr attribute="Reference" firstNonSpace="true" context="#stay" String="\*\S+" /> + <RegExpr attribute="Data Types" firstNonSpace="true" context="after-data" String="&dataTypes;" /> + <RegExpr attribute="Alias" firstNonSpace="true" context="after-data" String="&alias;" /> + <RegExpr attribute="Reference" firstNonSpace="true" context="after-data" String="&reference;" /> - <RegExpr attribute="Key" context="attribute-pre" String="[^"'#\-\s][^:#]*:(?=\s|$)"/> - <RegExpr attribute="Key" context="attribute-pre" String="\-([^\s:#][^:#]*)?\:(?=\s|$)"/> - <RegExpr attribute="Key" context="attribute-pre" String="&keyDQ;:(?=\s|$)"/> - <RegExpr attribute="Key" context="attribute-pre" String="&keySQ;:(?=\s|$)"/> - <RegExpr attribute="Key" context="attribute-pre" String=":(?=\s|$)"/> + <RegExpr attribute="Key" context="dpoints-attribute-pre" String="[^"'#\-\s][^:#]*(?=:(\s|$))"/> + <RegExpr attribute="Key" context="dpoints-attribute-pre" String="\-([^\s:#][^:#]*)?(?=:(\s|$))"/> + <RegExpr attribute="Key" context="dpoints-attribute-pre" String="&keyDQ;(?=:(\s|$))"/> + <RegExpr attribute="Key" context="dpoints-attribute-pre" String="&keySQ;(?=:(\s|$))"/> + <RegExpr attribute="Key Points Operator" context="attribute-pre" String=":(?=\s|$)"/> - <DetectChar attribute="String" context="string" char="'" beginRegion="String" /> - <DetectChar attribute="String" context="stringx" char=""" beginRegion="String" /> + <DetectChar attribute="String" firstNonSpace="true" context="string" char="'" beginRegion="String" /> + <DetectChar attribute="String" firstNonSpace="true" context="stringx" char=""" beginRegion="String" /> <IncludeRules context="values-firstnonspace" /> <DetectSpaces/> </context> <context attribute="Normal Text" lineEndContext="#pop" name="mapping-key" fallthrough="true" fallthroughContext="#pop"> + <RegExpr attribute="Comment" context="#pop!comment" String="(^|\s+)#" /> <DetectSpaces /> <RegExpr attribute="Operator" context="#pop!dash" String="\-(?=\s|$)" /> - <RegExpr attribute="Data Types" context="#pop" String="!!\S+" /> - <RegExpr attribute="Alias" context="#pop" String="&\S+" /> - <RegExpr attribute="Reference" context="#pop" String="\*\S+" /> + <RegExpr attribute="Data Types" context="#pop!after-data" String="&dataTypes;" /> + <RegExpr attribute="Alias" context="#pop!after-data" String="&alias;" /> + <RegExpr attribute="Reference" context="#pop!after-data" String="&reference;" /> + + <DetectChar attribute="Operator" context="#pop!list" char="[" beginRegion="List" /> + <DetectChar attribute="Operator" context="#pop!hash" char="{" beginRegion="Hash" /> + <DetectChar attribute="String" context="#pop!string" char="'" beginRegion="String" /> + <DetectChar attribute="String" context="#pop!stringx" char=""" beginRegion="String" /> </context> - <context attribute="List" lineEndContext="#pop" name="dash" fallthrough="true" fallthroughContext="#pop"> + <context attribute="Normal Text" lineEndContext="#pop" name="dash" fallthrough="true" fallthroughContext="#pop"> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> <DetectSpaces/> - <DetectChar attribute="Comment" context="comment" char="#" /> - <RegExpr attribute="Data Types" context="#stay" String="!!\S+" /> - <RegExpr attribute="Alias" context="#stay" String="&\S+" /> - <RegExpr attribute="Reference" context="#stay" String="\*\S+" /> + <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" /> + <RegExpr attribute="Alias" context="#stay" String="&alias;" /> + <RegExpr attribute="Reference" context="#stay" String="&reference;" /> <IncludeRules context="values" /> <DetectChar attribute="Operator" context="#pop!mapping-key" char="?" /> <RegExpr attribute="Operator" context="#stay" String="\-(?=\s|$)" /> + + <DetectChar attribute="Operator" context="#pop!list" char="[" beginRegion="List" /> + <DetectChar attribute="Operator" context="#pop!hash" char="{" beginRegion="Hash" /> + <DetectChar attribute="String" context="#pop!string" char="'" beginRegion="String" /> + <DetectChar attribute="String" context="#pop!stringx" char=""" beginRegion="String" /> + </context> + + <!-- Highlight lists, hashes and strings after a data type, reference or alias --> + <context attribute="Normal Text" lineEndContext="#pop" name="after-data" fallthrough="true" fallthroughContext="#pop"> + <RegExpr attribute="Comment" context="#pop!comment" String="(^|\s+)#" /> + <DetectSpaces /> + <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" /> + <RegExpr attribute="Alias" context="#stay" String="&alias;" /> + <RegExpr attribute="Reference" context="#stay" String="&reference;" /> + + <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" /> + <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" /> + <DetectChar attribute="String" context="string" char="'" beginRegion="String" /> + <DetectChar attribute="String" context="stringx" char=""" beginRegion="String" /> </context> <context attribute="Document Header" lineEndContext="#pop" name="header"> - <DetectChar attribute="Comment" context="comment" char="#" /> - <RegExpr attribute="Literal/Folded Operator" context="#pop!literal-block-simple" String="&literalOp;(?=&endValue;)" beginRegion="Literal" /> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> + <RegExpr attribute="Literal/Folded Operator" context="header-literal-operator" String="\s&literalOp;(?=&endValue;)" lookAhead="true" /> + </context> + <context attribute="Document Header" lineEndContext="#pop#pop" name="header-literal-operator" fallthrough="true" fallthroughContext="#pop"> + <DetectSpaces /> + <RegExpr attribute="Literal/Folded Operator" context="#pop#pop!literal-block-simple" String="&literalOp;" beginRegion="Literal" /> </context> <context attribute="End of Document" lineEndContext="#stay" name="EOD"> @@ -100,163 +134,180 @@ </context> <context attribute="Attribute" lineEndContext="#pop#pop" name="attribute"> - <DetectChar attribute="Comment" context="comment" char="#" /> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> </context> <context attribute="Attribute" lineEndContext="#stay" name="list-attribute-inline"> <AnyChar attribute="Operator" context="#pop#pop" lookAhead="true" String=",]" /> - <DetectChar attribute="Comment" context="comment" char="#" /> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> </context> <context attribute="Attribute" lineEndContext="#stay" name="hash-attribute-inline"> <AnyChar attribute="Operator" context="#pop#pop" lookAhead="true" String=",}" /> - <DetectChar attribute="Comment" context="comment" char="#" /> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> </context> + <!-- Attribute --> + <context attribute="Attribute" lineEndContext="#pop" name="dpoints-attribute-pre" fallthrough="true" fallthroughContext="#pop!attribute-pre"> + <DetectChar attribute="Key Points Operator" context="#pop!attribute-pre" char=":" /> <!-- Highlight two points after Key --> + </context> <context attribute="Attribute" lineEndContext="#pop" name="attribute-pre" fallthrough="true" fallthroughContext="attribute"> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> <DetectSpaces/> - <DetectChar attribute="Comment" context="comment" char="#" /> <DetectChar attribute="Operator" context="#stay" char="?" /> - <RegExpr attribute="Data Types" context="#stay" String="!!\S+" /> + <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" /> <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" /> <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" /> <DetectChar attribute="String" context="attribute-string" char="'" beginRegion="String" /> <DetectChar attribute="String" context="attribute-stringx" char=""" beginRegion="String" /> - <RegExpr attribute="Alias" context="#stay" String="&\S+(?=\s+[\[\{])" /> - <RegExpr attribute="Reference" context="#stay" String="\*\S+(?=\s+[\[\{])" /> - <RegExpr attribute="Alias" context="attribute" String="&\S+" /> - <RegExpr attribute="Reference" context="attribute" String="\*\S+" /> + <RegExpr attribute="Alias" context="#stay" String="&alias;(?=\s+[\[\{])" /> + <RegExpr attribute="Reference" context="#stay" String="&reference;(?=\s+[\[\{])" /> + <RegExpr attribute="Alias" context="attribute" String="&alias;" /> + <RegExpr attribute="Reference" context="attribute" String="&reference;" /> <IncludeRules context="values" /> + <RegExpr attribute="Literal/Folded Operator" context="#stay" String="&literalOp;(?=&endValue;)" /> </context> <context attribute="Attribute" lineEndContext="#pop" name="default-attribute-pre-inline"> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> <DetectSpaces/> - <DetectChar attribute="Comment" context="comment" char="#" /> <DetectChar attribute="Operator" context="#stay" char="?" /> - <RegExpr attribute="Data Types" context="#stay" String="!!\S+" /> + <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" /> <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" /> <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" /> <DetectChar attribute="String" context="attribute-string-inline" char="'" beginRegion="String" /> <DetectChar attribute="String" context="attribute-stringx-inline" char=""" beginRegion="String" /> - <RegExpr attribute="Alias" context="#stay" String="&\S+(?=\s+[\[\{])" /> - <RegExpr attribute="Reference" context="#stay" String="\*\S+(?=\s+[\[\{])" /> + <RegExpr attribute="Alias" context="#stay" String="&alias;(?=\s+[\[\{])" /> + <RegExpr attribute="Reference" context="#stay" String="&reference;(?=\s+[\[\{])" /> </context> + <!-- Attribute Inline, Within List --> + <context attribute="Attribute" lineEndContext="#pop" name="dpoints-list-attribute-pre-inline" fallthrough="true" fallthroughContext="#pop!list-attribute-pre-inline"> + <DetectChar attribute="Key Points Operator" context="#pop!list-attribute-pre-inline" char=":" /> <!-- Highlight two points after Key --> + </context> <context attribute="Attribute" lineEndContext="#pop" name="list-attribute-pre-inline" fallthrough="true" fallthroughContext="list-attribute-inline"> <IncludeRules context="default-attribute-pre-inline" /> - <RegExpr attribute="Alias" context="list-attribute-inline" String="&\S+" /> - <RegExpr attribute="Reference" context="list-attribute-inline" String="\*\S+" /> + <RegExpr attribute="Alias" context="list-attribute-inline" String="&alias;" /> + <RegExpr attribute="Reference" context="list-attribute-inline" String="&reference;" /> <AnyChar attribute="Operator" context="#pop" lookAhead="true" String=",]" /> <IncludeRules context="values-inline" /> </context> + + <!-- Attribute Inline, Within Hash --> + <context attribute="Attribute" lineEndContext="#pop" name="dpoints-hash-attribute-pre-inline" fallthrough="true" fallthroughContext="#pop!hash-attribute-pre-inline"> + <DetectChar attribute="Key Points Operator" context="#pop!hash-attribute-pre-inline" char=":" /> <!-- Highlight two points after Key --> + </context> <context attribute="Attribute" lineEndContext="#pop" name="hash-attribute-pre-inline" fallthrough="true" fallthroughContext="hash-attribute-inline"> <IncludeRules context="default-attribute-pre-inline" /> - <RegExpr attribute="Alias" context="hash-attribute-inline" String="&\S+" /> - <RegExpr attribute="Reference" context="hash-attribute-inline" String="\*\S+" /> + <RegExpr attribute="Alias" context="hash-attribute-inline" String="&alias;" /> + <RegExpr attribute="Reference" context="hash-attribute-inline" String="&reference;" /> <AnyChar attribute="Operator" context="#pop" lookAhead="true" String=",}" /> <IncludeRules context="values-inline" /> </context> + <!-- List --> <!-- Context "find-values-list" highlights values and then sends to "list-element" --> - <context attribute="List" lineEndContext="#stay" name="list" fallthrough="true" fallthroughContext="#pop!find-values-list"> + <context attribute="List" lineEndContext="#stay" name="list" fallthrough="true" fallthroughContext="#pop!find-values-list" noIndentationBasedFolding="true"> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> <DetectSpaces /> <DetectChar attribute="Operator" context="#pop!find-values-list" char="?" /> - <DetectChar attribute="Comment" context="comment" char="#" /> </context> - <context attribute="List" lineEndContext="#stay" name="list-element"> - <DetectChar attribute="Comment" context="comment" char="#" /> + <context attribute="List" lineEndContext="#stay" name="list-element" noIndentationBasedFolding="true"> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> <DetectChar attribute="Operator" context="#pop" char="]" endRegion="List" /> <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" /> <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" /> - <RegExpr attribute="Key" context="list-attribute-pre-inline" String="[^"'#\-,\]\s][^:#,\]]*:(?=\s|$)"/> - <RegExpr attribute="Key" context="list-attribute-pre-inline" String="\-([^\s:#,\]][^:#,\]]*)?\:(?=\s|$)"/> - <RegExpr attribute="Key" context="list-attribute-pre-inline" String="&keyDQ;:(?=\s|$)"/> - <RegExpr attribute="Key" context="list-attribute-pre-inline" String="&keySQ;:(?=\s|$)"/> - <RegExpr attribute="Key" context="list-attribute-pre-inline" String=":(?=\s|$)" firstNonSpace="true" /> + <RegExpr attribute="Key" context="dpoints-list-attribute-pre-inline" String="[^"'#\-,\]\s][^:#,\]]*(?=:(\s|$))"/> + <RegExpr attribute="Key" context="dpoints-list-attribute-pre-inline" String="\-([^\s:#,\]][^:#,\]]*)?(?=:(\s|$))"/> + <RegExpr attribute="Key" context="dpoints-list-attribute-pre-inline" String="&keyDQ;(?=:(\s|$))"/> + <RegExpr attribute="Key" context="dpoints-list-attribute-pre-inline" String="&keySQ;(?=:(\s|$))"/> + <RegExpr attribute="Key Points Operator" context="list-attribute-pre-inline" String=":(?=\s|$)" firstNonSpace="true" /> - <RegExpr attribute="Data Types" context="#stay" String="!!\S+" /> - <RegExpr attribute="Alias" context="#stay" String="&\S+" /> - <RegExpr attribute="Reference" context="#stay" String="\*\S+" /> + <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" /> + <RegExpr attribute="Alias" context="#stay" String="&alias;" /> + <RegExpr attribute="Reference" context="#stay" String="&reference;" /> <DetectChar attribute="String" context="string" char="'" beginRegion="String" /> <DetectChar attribute="String" context="stringx" char=""" beginRegion="String" /> <DetectChar attribute="Operator" context="#pop!list" char="," /> <IncludeRules context="values-list" /> </context> - <context attribute="Hash" lineEndContext="#stay" name="hash" fallthrough="true" fallthroughContext="#pop!hash-element"> + <!-- Hash --> + <context attribute="Hash" lineEndContext="#stay" name="hash" fallthrough="true" fallthroughContext="#pop!hash-element" noIndentationBasedFolding="true"> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> <DetectSpaces /> <DetectChar attribute="Operator" context="#pop!hash-element" char="?" /> - <DetectChar attribute="Comment" context="comment" char="#" /> </context> - <context attribute="Hash" lineEndContext="#stay" name="hash-element"> + <context attribute="Hash" lineEndContext="#stay" name="hash-element" noIndentationBasedFolding="true"> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> <DetectSpaces/> - <DetectChar attribute="Comment" context="comment" char="#" /> - <RegExpr attribute="Key" context="hash-attribute-pre-inline" String="[^\s"'#\-,\}\s][^:#,\}]*:(?=\s|$)"/> - <RegExpr attribute="Key" context="hash-attribute-pre-inline" String="\-([^\s:#,\}][^:#,\}]*)?\:(?=\s|$)"/> - <RegExpr attribute="Key" context="hash-attribute-pre-inline" String="&keyDQ;:(?=\s|$)"/> - <RegExpr attribute="Key" context="hash-attribute-pre-inline" String="&keySQ;:(?=\s|$)"/> - <RegExpr attribute="Key" context="hash-attribute-pre-inline" String=":(?=\s|$)"/> + <RegExpr attribute="Key" context="dpoints-hash-attribute-pre-inline" String="[^\s"'#\-,\}\s][^:#,\}]*(?=:(\s|$))"/> + <RegExpr attribute="Key" context="dpoints-hash-attribute-pre-inline" String="\-([^\s:#,\}][^:#,\}]*)?(?=:(\s|$))"/> + <RegExpr attribute="Key" context="dpoints-hash-attribute-pre-inline" String="&keyDQ;(?=:(\s|$))"/> + <RegExpr attribute="Key" context="dpoints-hash-attribute-pre-inline" String="&keySQ;(?=:(\s|$))"/> + <RegExpr attribute="Key Points Operator" context="hash-attribute-pre-inline" String=":(?=\s|$)"/> <DetectChar attribute="Operator" context="#pop" char="}" endRegion="Hash" /> <DetectChar attribute="Operator" context="#pop!hash" char="," /> <!-- This improves highlighting in keys with multiple lines --> - <RegExpr attribute="Data Types" context="#stay" String="!!\S+" /> - <RegExpr attribute="Alias" context="#stay" String="&\S+" /> - <RegExpr attribute="Reference" context="#stay" String="\*\S+" /> + <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" /> + <RegExpr attribute="Alias" context="#stay" String="&alias;" /> + <RegExpr attribute="Reference" context="#stay" String="&reference;" /> <DetectChar attribute="String" context="string" char="'" beginRegion="String" /> <DetectChar attribute="String" context="stringx" char=""" beginRegion="String" /> </context> - <context attribute="String" lineEndContext="#stay" name="attribute-string"> + <!-- Strings --> + <context attribute="String" lineEndContext="#stay" name="attribute-string" noIndentationBasedFolding="true"> <DetectIdentifier /> <IncludeRules context="escaped-char-singleq" /> <DetectChar attribute="String" context="attribute-end" char="'" endRegion="String" /> </context> - <context attribute="String" lineEndContext="#stay" name="attribute-stringx"> + <context attribute="String" lineEndContext="#stay" name="attribute-stringx" noIndentationBasedFolding="true"> <DetectIdentifier /> <IncludeRules context="escaped-char-doubleq" /> <DetectChar attribute="String" context="attribute-end" char=""" endRegion="String" /> </context> - <context attribute="String" lineEndContext="#stay" name="attribute-string-inline"> + <context attribute="String" lineEndContext="#stay" name="attribute-string-inline" noIndentationBasedFolding="true"> <DetectIdentifier /> <IncludeRules context="escaped-char-singleq" /> <DetectChar attribute="String" context="attribute-end-inline" char="'" endRegion="String" /> </context> - <context attribute="String" lineEndContext="#stay" name="attribute-stringx-inline"> + <context attribute="String" lineEndContext="#stay" name="attribute-stringx-inline" noIndentationBasedFolding="true"> <DetectIdentifier /> <IncludeRules context="escaped-char-doubleq" /> <DetectChar attribute="String" context="attribute-end-inline" char=""" endRegion="String" /> </context> <context attribute="Error" lineEndContext="#pop#pop#pop" name="attribute-end"> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> <DetectSpaces attribute="Normal Text" context="#stay"/> - <DetectChar attribute="Comment" context="comment" char="#" /> </context> <context attribute="Error" lineEndContext="#pop#pop#pop" name="attribute-end-inline"> + <RegExpr attribute="Comment" context="comment" String="(^|\s+)#" /> <DetectSpaces attribute="Normal Text" context="#stay"/> <AnyChar attribute="String" context="#pop#pop#pop" lookAhead="true" String="}]"/> <DetectChar attribute="Operator" context="#pop#pop#pop" lookAhead="true" char="," /> - <DetectChar attribute="Comment" context="comment" char="#" /> </context> - <context attribute="String" lineEndContext="#stay" name="string"> + <context attribute="String" lineEndContext="#stay" name="string" noIndentationBasedFolding="true"> <DetectIdentifier /> <IncludeRules context="escaped-char-singleq" /> <DetectChar attribute="String" context="#pop" char="'" endRegion="String" /> </context> - <context attribute="String" lineEndContext="#stay" name="stringx"> + <context attribute="String" lineEndContext="#stay" name="stringx" noIndentationBasedFolding="true"> <DetectIdentifier /> <IncludeRules context="escaped-char-doubleq" /> <DetectChar attribute="String" context="#pop" char=""" endRegion="String" /> @@ -351,8 +402,10 @@ > key: !!type >- > ^Start the folded text --> + <RegExpr attribute="Key Points Operator" context="literal-block-key" column="0" + String="^(&space;*)\:(?=\s+(?:(?:&keyDQ;|&keySQ;|[^#])*[^#\w\|<>"'])?&literalOp;&endValue;)" /> <RegExpr attribute="Key" context="literal-block-key" column="0" - String="^(&space;*)(?:[^"'#\-\?\s][^:#]*|\-(?:[^\s:#][^:#]*)?|&keyDQ;|&keySQ;)?\:(?=\s+(?:(?:&keyDQ;|&keySQ;|[^#])*[^#\w\|<>"'])?&literalOp;&endValue;)" /> + String="^(&space;*)(?:[^"'#\-\?\s][^:#]*|\-(?:[^\s:#][^:#]*)?|&keyDQ;|&keySQ;)(?=\:\s+(?:(?:&keyDQ;|&keySQ;|[^#])*[^#\w\|<>"'])?&literalOp;&endValue;)" /> <!-- CASE 4: Is there an operator "?" or "-" at the beginning of the line. NOTE: Nested characters "-" and "?" are considered as part of the indentation. @@ -385,7 +438,7 @@ <!-- If the line with the literal operator starts with the "-" or "?" operator. NOTE: The indentation capture is limited to 6 nested operators. --> - <context attribute="Normal Text" lineEndContext="#pop" name="start-literal-block-withdash"> + <context attribute="Normal Text" lineEndContext="#pop" name="start-literal-block-withdash" noIndentationBasedFolding="true"> <!-- With Key: Capture the Key indentation --> <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s2" String="^(&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/> <RegExpr attribute="Operator" context="#pop!literal-block-key-withdash-s3" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)(?=&keyAfterOp;:\s)" column="0"/> @@ -402,157 +455,163 @@ <RegExpr attribute="Operator" context="#pop!literal-block-withdash-s6" String="^(&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-](&space;*)[\?\-]\s*(?=[^#\-\?\s]|\-[^\s#])" column="0"/> </context> <!-- Capture the indentation of data type, reference or alias --> - <context attribute="Normal Text" lineEndContext="#pop" name="start-literal-block-other"> + <context attribute="Normal Text" lineEndContext="#pop" name="start-literal-block-other" noIndentationBasedFolding="true"> <!-- The text with the same indentation will be considered literal --> - <RegExpr attribute="Data Types" context="#pop!literal-block-after-data" String="^(&space;+)!!\S+" column="0" /> - <RegExpr attribute="Alias" context="#pop!literal-block-after-data" String="^(&space;+)&\S+" column="0" /> - <RegExpr attribute="Reference" context="#pop!literal-block-after-data" String="^(&space;+)\*\S+" column="0" /> + <RegExpr attribute="Data Types" context="#pop!literal-block-after-data" String="^(&space;+)&dataTypes;" column="0" /> + <RegExpr attribute="Alias" context="#pop!literal-block-after-data" String="^(&space;+)&alias;" column="0" /> + <RegExpr attribute="Reference" context="#pop!literal-block-after-data" String="^(&space;+)&reference;" column="0" /> <!-- The text after a space will be considered literal (empty text is captured) --> - <RegExpr attribute="Data Types" context="#pop!literal-block-withdash-s1" String="^()!!\S+" column="0" /> - <RegExpr attribute="Alias" context="#pop!literal-block-withdash-s1" String="^()&\S+" column="0" /> - <RegExpr attribute="Reference" context="#pop!literal-block-withdash-s1" String="^()\*\S+" column="0" /> + <RegExpr attribute="Data Types" context="#pop!literal-block-withdash-s1" String="^()&dataTypes;" column="0" /> + <RegExpr attribute="Alias" context="#pop!literal-block-withdash-s1" String="^()&alias;" column="0" /> + <RegExpr attribute="Reference" context="#pop!literal-block-withdash-s1" String="^()&reference;" column="0" /> </context> <!-- Highlight data/attribute before the literal operator (Note that if there is a line break within a string or bracket, the literal line will not be highlighted). --> - <context attribute="Normal Text" lineEndContext="#pop#pop" name="before-literal-operator"> + <context attribute="Attribute" lineEndContext="#pop#pop" name="before-literal-operator" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Operator" context="#pop!end-literal-operator" String="&literalOp;(?=&endValue;)" beginRegion="Literal" /> <RegExpr attribute="Error" context="#pop#pop" String="([&\*]|!!)\S*&literalOp;(?=&endValue;)" /> - <RegExpr attribute="Data Types" context="#stay" String="!!\S+" /> - <RegExpr attribute="Alias" context="#stay" String="&\S+" /> - <RegExpr attribute="Reference" context="#stay" String="\*\S+" /> + <RegExpr attribute="Data Types" context="#stay" String="&dataTypes;" /> + <RegExpr attribute="Alias" context="#stay" String="&alias;" /> + <RegExpr attribute="Reference" context="#stay" String="&reference;" /> <DetectChar attribute="Operator" context="list" char="[" beginRegion="List" /> <DetectChar attribute="Operator" context="hash" char="{" beginRegion="Hash" /> <DetectChar attribute="String" context="string" char="'" beginRegion="String" /> <DetectChar attribute="String" context="stringx" char=""" beginRegion="String" /> </context> - <context attribute="Attribute" lineEndContext="#pop#pop" name="key-before-literal-operator"> + + <context attribute="Normal Text" lineEndContext="#pop#pop" name="dpoints-key-before-literal-operator" fallthrough="true" fallthroughContext="#pop#pop" noIndentationBasedFolding="true"> + <DetectChar attribute="Key Points Operator" context="#pop!key-before-literal-operator" char=":" /> + </context> + <context attribute="Attribute" lineEndContext="#pop#pop" name="key-before-literal-operator" noIndentationBasedFolding="true"> <IncludeRules context="before-literal-operator" /> <DetectChar attribute="Operator" context="#stay" char="?" /> </context> - <context attribute="Normal Text" lineEndContext="#pop" name="end-literal-operator"> - <DetectChar attribute="Comment" context="#pop!comment" char="#" /> + <context attribute="Attribute" lineEndContext="#pop" name="end-literal-operator" noIndentationBasedFolding="true"> + <RegExpr attribute="Comment" context="#pop!comment" String="(^|\s+)#" /> </context> <!-- Common rules for the content of the literal blocks --> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-default"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-default" noIndentationBasedFolding="true"> <!-- End literal/folded block --> <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" /> <!-- Find literal/folded operator --> <RegExpr context="before-literal-operator" String="\S" lookAhead="true" /> </context> - <context attribute="Normal Text" lineEndContext="#pop" name="literal-block-key-default"> + <context attribute="Normal Text" lineEndContext="#pop" name="literal-block-key-default" noIndentationBasedFolding="true"> <!-- End literal/folded block --> <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" /> <!-- Detect Key before the literal/folded operator --> - <RegExpr attribute="Key" context="key-before-literal-operator" String="&keyAfterOp;:(?=\s)" /> + <RegExpr attribute="Key" context="dpoints-key-before-literal-operator" String="&keyAfterOp;(?=:\s)" /> <RegExpr attribute="Normal Text" context="#pop" String="\S" lookAhead="true" endRegion="Literal" /> </context> <!-- Content of the literal block: --> <!-- If the literal operator is starting the line (after a space, use block indentation) --> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-only-operator" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-only-operator" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1.*$" dynamic="true" column="0" /> <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" /> - <DetectChar attribute="Comment" context="comment" char="#" /> + <RegExpr attribute="Comment" context="comment" String="(^|\s)#" /> <RegExpr context="#pop" String="\S" lookAhead="true" endRegion="Literal" /> </context> <!-- If the literal operator is the first character of a line (or after header) --> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-simple"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-simple" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^\s.*$" column="0" /> <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" /> - <DetectChar attribute="Comment" context="comment" char="#" /> + <RegExpr attribute="Comment" context="comment" String="(^|\s)#" /> </context> <!-- If there is a data type or other content before the liretal operator (use block indentation) --> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-after-data" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-after-data" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1.*$" dynamic="true" column="0" /> <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" /> <RegExpr context="before-literal-operator" String="\S" lookAhead="true" /> </context> <!-- If there is a key before the literal operator --> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1\s.*$" dynamic="true" column="0" /> <RegExpr attribute="Normal Text" context="#pop" String="^\s*\S" lookAhead="true" column="0" endRegion="Literal" /> <!-- Attribute of the Key (the Key was previously highlighted) --> + <RegExpr attribute="Key Points Operator" context="key-before-literal-operator" String=":\s" /> <RegExpr context="key-before-literal-operator" String="\S" lookAhead="true" /> </context> <!-- If there are dashes/"?" before the literal operator --> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s1" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s1" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1\s.*$" dynamic="true" column="0" /> <IncludeRules context="literal-block-default" /> </context> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s2" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s2" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2&space;\s.*$" dynamic="true" column="0" /> <IncludeRules context="literal-block-default" /> </context> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s3" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s3" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3&space;{2}\s.*$" dynamic="true" column="0" /> <IncludeRules context="literal-block-default" /> </context> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s4" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s4" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4&space;{3}\s.*$" dynamic="true" column="0" /> <IncludeRules context="literal-block-default" /> </context> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s5" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s5" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5&space;{4}\s.*$" dynamic="true" column="0" /> <IncludeRules context="literal-block-default" /> </context> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s6" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-withdash-s6" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5%6&space;{5}\s.*$" dynamic="true" column="0" /> <IncludeRules context="literal-block-default" /> </context> <!-- If there are dashes/"?" and a Key before the literal operator --> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s2" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s2" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2&space;\s.*$" dynamic="true" column="0" /> <IncludeRules context="literal-block-key-default" /> </context> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s3" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s3" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3&space;{2}\s.*$" dynamic="true" column="0" /> <IncludeRules context="literal-block-key-default" /> </context> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s4" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s4" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4&space;{3}\s.*$" dynamic="true" column="0" /> <IncludeRules context="literal-block-key-default" /> </context> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s5" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s5" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5&space;{4}\s.*$" dynamic="true" column="0" /> <IncludeRules context="literal-block-key-default" /> </context> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s6" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s6" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5%6&space;{5}\s.*$" dynamic="true" column="0" /> <IncludeRules context="literal-block-key-default" /> </context> - <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s7" dynamic="true"> + <context attribute="Normal Text" lineEndContext="#stay" name="literal-block-key-withdash-s7" dynamic="true" noIndentationBasedFolding="true"> <RegExpr attribute="Literal/Folded Block" context="#stay" String="^%1%2%3%4%5%6%7&space;{6}\s.*$" dynamic="true" column="0" /> <IncludeRules context="literal-block-key-default" /> </context> </contexts> <itemDatas> - <itemData name="Normal Text" defStyleNum="dsNormal" /> - <itemData name="List" defStyleNum="dsNormal" /> - <itemData name="Hash" defStyleNum="dsNormal" /> + <itemData name="Normal Text" defStyleNum="dsAttribute" /> + <itemData name="Attribute" defStyleNum="dsAttribute" /> + <itemData name="List" defStyleNum="dsAttribute" /> + <itemData name="Hash" defStyleNum="dsAttribute" /> <itemData name="Comment" defStyleNum="dsComment" /> <itemData name="End of Document" defStyleNum="dsComment" /> - <itemData name="Attribute" defStyleNum="dsAttribute" /> - <itemData name="Document Header" defStyleNum="dsOthers" /> - <itemData name="Data Types" defStyleNum="dsDataType" /> - <itemData name="Alias" defStyleNum="dsDataType" /> - <itemData name="Reference" defStyleNum="dsDataType" /> - <itemData name="Key" defStyleNum="dsFunction" /> - <itemData name="Directive" defStyleNum="dsOthers" /> + <itemData name="Document Header" defStyleNum="dsPreprocessor" /> + <itemData name="Data Types" defStyleNum="dsOthers" /> + <itemData name="Alias" defStyleNum="dsOthers" /> + <itemData name="Reference" defStyleNum="dsOthers" /> + <itemData name="Key" defStyleNum="dsFunction" bold="1" /> + <itemData name="Directive" defStyleNum="dsPreprocessor" /> + <itemData name="Key Points Operator" defStyleNum="dsKeyword" /> <itemData name="Operator" defStyleNum="dsKeyword" /> <itemData name="String" defStyleNum="dsString" /> <itemData name="Escaped Character" defStyleNum="dsSpecialChar" /> - <itemData name="Literal/Folded Operator" defStyleNum="dsString" bold="1" /> + <itemData name="Literal/Folded Operator" defStyleNum="dsChar" bold="1" /> <itemData name="Literal/Folded Block" defStyleNum="dsNormal" /> <itemData name="Null" defStyleNum="dsChar" /> <itemData name="Boolean" defStyleNum="dsChar" /> @@ -564,6 +623,10 @@ </highlighting> <general> + <folding indentationsensitive="1" /> + <emptyLines> + <emptyLine regexpr="(?:\s+|\s*#.*)"/> + </emptyLines> <comments> <comment name="singleLine" start="#" position="afterwhitespace" /> </comments>