summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorVlasta Vesely <vlastavesely@protonmail.ch>2023-01-16 19:48:45 +0000
committerChristian Hergert <christian@hergert.me>2023-01-16 19:48:45 +0000
commit9b47ee5bdaa2bbc0f84442e5467676318c5c1296 (patch)
tree1ba0891400b0a9ef82ac477847658960813dfab8 /data
parent2a6d8226830bf33323d7c823890b61a777001e95 (diff)
downloadgtksourceview-9b47ee5bdaa2bbc0f84442e5467676318c5c1296.tar.gz
c.lang: highlight binary numbers
Diffstat (limited to 'data')
-rw-r--r--data/language-specs/c.lang19
1 files changed, 19 insertions, 0 deletions
diff --git a/data/language-specs/c.lang b/data/language-specs/c.lang
index 641daf53..8ebb1fc7 100644
--- a/data/language-specs/c.lang
+++ b/data/language-specs/c.lang
@@ -47,6 +47,7 @@
<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"/>
@@ -187,6 +188,22 @@
</match>
</context>
+ <context id="binary" style-ref="binary">
+ <match extended="true">
+ (?&lt;![\w\.])
+ 0[bB][01]+[uUlL]*
+ (?![\w\.])
+ </match>
+ </context>
+
+ <context id="invalid-binary" style-ref="error">
+ <match extended="true">
+ (?&lt;![\w\.])
+ 0[bB][01]*[2-9][a-zA-Z0-9]*[uUlL]*
+ (?![\w\.])
+ </match>
+ </context>
+
<context id="decimal" style-ref="decimal">
<match extended="true">
(?&lt;![\w\.])
@@ -325,6 +342,8 @@
<context ref="invalid-hexadecimal"/>
<context ref="octal"/>
<context ref="invalid-octal"/>
+ <context ref="binary"/>
+ <context ref="invalid-binary"/>
<context ref="decimal"/>
<context ref="keywords"/>
<context ref="type-keywords"/>