summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hergert <chergert@redhat.com>2023-01-18 17:19:27 -0800
committerChristian Hergert <chergert@redhat.com>2023-01-18 17:19:27 -0800
commit1b8d60f33e7020813a60e6af59a12060170b20ac (patch)
tree9e9662d938f17883753fdd4a3341839c90372067
parent1dbbb01da98140e0b2d5d0c6c2df29247650ed83 (diff)
downloadgtksourceview-1b8d60f33e7020813a60e6af59a12060170b20ac.tar.gz
c.lang: allow styling "" and <> includes separately
-rw-r--r--data/language-specs/c.lang59
1 files changed, 36 insertions, 23 deletions
diff --git a/data/language-specs/c.lang b/data/language-specs/c.lang
index 8ebb1fc7..61ca1d2d 100644
--- a/data/language-specs/c.lang
+++ b/data/language-specs/c.lang
@@ -32,28 +32,29 @@
</metadata>
<styles>
- <style id="comment" name="Comment" map-to="def:comment"/>
- <style id="string" name="String" map-to="def:string"/>
- <style id="preprocessor" name="Preprocessor" map-to="def:preprocessor"/>
- <style id="common-defines" name="Common Defines" map-to="def:special-constant"/>
- <style id="included-file" name="Included File" map-to="def:string"/>
- <style id="char" name="Character" map-to="def:character"/>
- <style id="keyword" name="Keyword" map-to="def:keyword"/>
- <style id="type-keyword" name="Type Keyword" map-to="c:keyword"/>
- <style id="operator" name="Operator" map-to="def:operator"/>
- <style id="type" name="Data Type" map-to="def:type"/>
- <style id="storage-class" name="Storage Class" map-to="def:type"/>
- <style id="printf" name="printf Conversion" map-to="def:special-char"/>
- <style id="escaped-character" name="Escaped Character" map-to="def:special-char"/>
- <style id="floating-point" name="Floating point number" map-to="def:floating-point"/>
- <style id="decimal" name="Decimal number" map-to="def:decimal"/>
- <style id="binary" name="Binary number" map-to="def:base-n-integer"/>
- <style id="octal" name="Octal number" map-to="def:base-n-integer"/>
- <style id="hexadecimal" name="Hexadecimal number" map-to="def:base-n-integer"/>
- <style id="boolean" name="Boolean value" map-to="def:boolean"/>
- <style id="standard-stream" name="Standard stream" map-to="def:constant"/>
- <style id="signal-name" name="Signal name" map-to="def:constant"/>
- <style id="error" name="Error" map-to="def:error"/>
+ <style id="comment" name="Comment" map-to="def:comment"/>
+ <style id="string" name="String" map-to="def:string"/>
+ <style id="preprocessor" name="Preprocessor" map-to="def:preprocessor"/>
+ <style id="common-defines" name="Common Defines" map-to="def:special-constant"/>
+ <style id="included-file" name="Included File" map-to="def:string"/>
+ <style id="included-relative-file" name="Included Relative File" map-to="c:included-file"/>
+ <style id="char" name="Character" map-to="def:character"/>
+ <style id="keyword" name="Keyword" map-to="def:keyword"/>
+ <style id="type-keyword" name="Type Keyword" map-to="c:keyword"/>
+ <style id="operator" name="Operator" map-to="def:operator"/>
+ <style id="type" name="Data Type" map-to="def:type"/>
+ <style id="storage-class" name="Storage Class" map-to="def:type"/>
+ <style id="printf" name="printf Conversion" map-to="def:special-char"/>
+ <style id="escaped-character" name="Escaped Character" map-to="def:special-char"/>
+ <style id="floating-point" name="Floating point number" map-to="def:floating-point"/>
+ <style id="decimal" name="Decimal number" map-to="def:decimal"/>
+ <style id="binary" name="Binary number" map-to="def:base-n-integer"/>
+ <style id="octal" name="Octal number" map-to="def:base-n-integer"/>
+ <style id="hexadecimal" name="Hexadecimal number" map-to="def:base-n-integer"/>
+ <style id="boolean" name="Boolean value" map-to="def:boolean"/>
+ <style id="standard-stream" name="Standard stream" map-to="def:constant"/>
+ <style id="signal-name" name="Signal name" map-to="def:constant"/>
+ <style id="error" name="Error" map-to="def:error"/>
</styles>
<definitions>
@@ -107,13 +108,24 @@
<match extended="true">
\%{preproc-start}
(include|import)\s*
- (".*?"|&lt;.*?&gt;)
+ (&lt;.*?&gt;)
</match>
<include>
<context id="included-file" sub-pattern="2" style-ref="included-file" class="path"/>
</include>
</context>
+ <context id="include-relative" style-ref="preprocessor">
+ <match extended="true">
+ \%{preproc-start}
+ (include|import)\s*
+ (".*?")
+ </match>
+ <include>
+ <context id="included-relative-file" sub-pattern="2" style-ref="included-relative-file" class="path"/>
+ </include>
+ </context>
+
<context id="preprocessor" style-ref="preprocessor" end-at-line-end="true">
<start extended="true">
\%{preproc-start}
@@ -334,6 +346,7 @@
<context ref="def:c-like-close-comment-outside-comment" style-ref="comment"/>
<context ref="if0-comment"/>
<context ref="include"/>
+ <context ref="include-relative"/>
<context ref="preprocessor"/>
<context ref="string"/>
<context ref="char"/>