Case-insensitive highlighting of hexadecimal constants

This commit is contained in:
john-batch
2021-08-15 16:00:41 +02:00
committed by Zachary Yedidia
parent 02ef99a3a6
commit c226779aca
10 changed files with 33 additions and 37 deletions

View File

@@ -12,7 +12,7 @@ rules:
- symbol: "[:=]"
- identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)="
- constant.string: "\"[^\"]*\""
- constant.number: "(?i)#[0-9A-F]{6,6}"
- constant.number: "(?i)#[0-9a-fA-F]{6,6}"
- constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
- comment: "<!--.+?-->"
- preproc: "<!DOCTYPE.+?>"

View File

@@ -7,7 +7,7 @@ rules:
# Rebase commands
- statement: "^(p(ick)?|r(eword)?|e(dit)?|s(quash)?|f(ixup)?|x|exec|b(reak)?|d(rop)?|l(abel)?|t|reset|m(erge)?)\\b"
# Commit IDs
- identifier: "\\b([0-9a-f]{7,40})\\b"
- identifier: "\\b([0-9a-fA-F]{7,40})\\b"
# Color keywords for Github (and others)
- type.keyword: "\\b(?i)((fix(es|ed)?|close(s|d)?) #[0-9]+)\\b"

View File

@@ -35,7 +35,7 @@ rules:
# Octal integer literal
- constant.number: "(?i)\\b0[0-7]([0-7_]*[0-7])?[GLIDF]?\\b"
# Hexadecimal integer literal
- constant.number: "(?i)\\b0x[0-9a-f]([0-9a-f_]*[0-9a-f])?[GLIDF]?\\b"
- constant.number: "(?i)\\b0x[0-9a-fA-F]([0-9a-f_]*[0-9a-fA-F])?[GLIDF]?\\b"
# Floating-point literal
- constant.number: "(?i)\\b[0-9]([0-9_]*[0-9])?([.][0-9]([0-9_]*[0-9])?)?(e[+-]?[0-9]([0-9_]*[0-9])?)?[DF]?\\b"
- constant.bool: "\\b(true|false|null)\\b"

View File

@@ -13,7 +13,7 @@ rules:
- symbol: "[:=]"
- identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|style|target|type|value|width)="
- constant.string: "\"[^\"]*\""
- constant.number: "(?i)#[0-9A-F]{6,6}"
- constant.number: "(?i)#[0-9a-fA-F]{6,6}"
- default:
start: ">"
end: "<"

View File

@@ -13,7 +13,7 @@ rules:
- symbol: "[:=]"
- identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|style|target|type|value|width)="
- constant.string: "\"[^\"]*\""
- constant.number: "(?i)#[0-9A-F]{6,6}"
- constant.number: "(?i)#[0-9a-fA-F]{6,6}"
- default:
start: ">"
end: "<"

View File

@@ -25,7 +25,7 @@ rules:
- statement: "([.:;,+*|=!\\%\\[\\]]|<|>|/|-|&)"
- constant.number: "(\\b(-?)?[0-9]+\\b|\\b\\[0-9]+\\.[0-9]+\\b|\\b0x[0-9A-F]+\\b)"
- constant.number: "(\\b(-?)?[0-9]+\\b|\\b\\[0-9]+\\.[0-9]+\\b|\\b0x[0-9a-fA-F]+\\b)"
- constant: "(@\\[(\\\\.|[^\\]])*\\]|@\\{(\\\\.|[^\\}])*\\}|@\\((\\\\.|[^\\)])*\\))"
- constant: "\\b<(\\\\.[^\\>])*\\>\\b"
- constant: "\\b(nil|NULL|YES|NO|TRUE|true|FALSE|false|self)\\b"
@@ -57,4 +57,3 @@ rules:
end: "\\*/"
rules:
- todo: "(TODO|XXX|FIXME):?"

View File

@@ -12,7 +12,7 @@ rules:
- special: "&[^;[[:space:]]]*;"
- symbol: "[:=]"
- identifier: "(alt|bgcolor|height|href|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)="
- constant.number: "(?i)#[0-9A-F]{6,6}"
- constant.number: "(?i)#[0-9a-fA-F]{6,6}"
- constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
- comment: "<!--.+?-->"
- default: "<\\?(php|=)\" end=\"\\?>"

View File

@@ -29,7 +29,7 @@ rules:
- constant.number: "\\b[0-9](_?[0-9])*(\\.([0-9](_?[0-9])*)?)?(e[0-9](_?[0-9])*)?\\b" # decimal
- constant.number: "\\b0b(_?[01])+\\b" # bin
- constant.number: "\\b0o(_?[0-7])+\\b" # oct
- constant.number: "\\b0x(_?[0-9a-f])+\\b" # hex
- constant.number: "\\b0x(_?[0-9a-fA-F])+\\b" # hex
- constant.string:
start: "\"\"\""

View File

@@ -18,7 +18,7 @@ rules:
- statement: "\\b(BEGIN|END|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|for|if|in|module|next|nil|not|or|private|protected|public|redo|rescue|retry|return|self|super|then|undef|unless|until|when|while|yield)\\b"
- constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
- constant.number: "(?i)\\b0x[0-9a-f][0-9a-f_]*\\b"
- constant.number: "(?i)\\b0x[0-9a-fA-F][0-9a-f_]*\\b"
- constant.number: "(?i)\\b0b[01][01_]*\\b"
- constant.number: "(?i)\\b[0-9][0-9_]*(['.'][0-9_]+)?(e[\\-]?[0-9_]+)?\\b"
# Ruby "Symbols"

View File

@@ -18,7 +18,7 @@ rules:
- identifier: "(alt|bgcolor|class|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|placeholder|size|span|src|style|target|type|value|width)="
- symbol: "[:=]"
- constant.string: "\"[^\"]*\""
- constant.number: "(?i)#[0-9A-F]{6,6}"
- constant.number: "(?i)#[0-9a-fA-F]{6,6}"
- symbol.tag: "<|>"
- constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
@@ -62,6 +62,3 @@ rules:
limit-group: symbol.tag
rules:
- include: "css"