mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-05 06:30:28 +09:00
Case-insensitive highlighting of hexadecimal constants
This commit is contained in:
committed by
Zachary Yedidia
parent
02ef99a3a6
commit
c226779aca
@@ -1,6 +1,6 @@
|
||||
filetype: erb
|
||||
|
||||
detect:
|
||||
detect:
|
||||
filename: "\\.erb$|\\.rhtml$"
|
||||
|
||||
rules:
|
||||
@@ -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.+?>"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -9,13 +9,13 @@ rules:
|
||||
- identifier: "\\b[A-Z_$]+\\b"
|
||||
# The style guide for JVM languages is PascalCase for classes and interfaces
|
||||
- identifier.class: "\\b[A-Z][a-zA-Z0-9$]+\\b"
|
||||
|
||||
|
||||
# Primitive types
|
||||
- type: "\\b(byte|short|int|long|float|double|char|boolean|void)\\b"
|
||||
|
||||
|
||||
# Type-related keywords
|
||||
- type.keyword: "\\b(private|public|protected|static|final|var|def)\\b"
|
||||
|
||||
|
||||
# Keywords
|
||||
- statement: "\\b(for|while|do|if|else|switch|case|default|try|catch|finally)\\b"
|
||||
- statement: "\\b(break|continue|return|throw|assert)\\b"
|
||||
@@ -23,11 +23,11 @@ rules:
|
||||
- statement: "\\b(this|super)\\b"
|
||||
# Unsused, but reserved keywords
|
||||
- statement: "\\b(goto|const)\\b"
|
||||
|
||||
|
||||
# Operators and punctuation
|
||||
- symbol.operator: "[-+*/%=<>^~&|!?:;,.@]|\\b(in|is|as|instanceof|new)\\b"
|
||||
- symbol.brackets: "[(){}]|\\[|\\]"
|
||||
|
||||
|
||||
# Decimal integer literal
|
||||
- constant.number: "(?i)\\b[1-9]([_0-9]*[0-9])?[GLIDF]?\\b"
|
||||
# Binary integer literal
|
||||
@@ -35,14 +35,14 @@ 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"
|
||||
|
||||
|
||||
# Annotations
|
||||
- identifier: "@[A-Za-z_$][A-Za-z0-9_$]*\\b"
|
||||
|
||||
|
||||
# Single-quoted strings
|
||||
- constant.string:
|
||||
start: "'"
|
||||
@@ -50,7 +50,7 @@ rules:
|
||||
skip: "\\\\."
|
||||
rules:
|
||||
- constant.specialChar: "\\\\([\"'bfnrst\\x24\\\\]|u[a-fA-F0-9]{4})"
|
||||
|
||||
|
||||
# This also matches the Triple-double-quoted strings region, but I can't really find a way to mitigate it, all the while still matching "" as a string correctly
|
||||
# Also, nesting ${} are never going to be matched correctly with just regex either, so highlighting will break if one is to nest interpolation
|
||||
# These two problems combined mean slight mistakes in highlighing that the user is just going to have to deal with
|
||||
@@ -63,7 +63,7 @@ rules:
|
||||
- constant.specialChar: "\\\\([\"'bfnrst\\x24\\\\]|u[a-fA-F0-9]{4})"
|
||||
- identifier.var: "\\x24[\\w\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE]+([.][a-zA-Z0-9_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\uFFFE]+)*"
|
||||
- identifier: "\\x24[{].*[}]"
|
||||
|
||||
|
||||
# Triple-double-quoted strings
|
||||
- constant.string:
|
||||
start: "\"\"\""
|
||||
@@ -76,7 +76,7 @@ rules:
|
||||
start: "[$][{]"
|
||||
end: "[}]"
|
||||
rules: []
|
||||
|
||||
|
||||
# Triple-single-quoted strings
|
||||
- constant.string:
|
||||
start: "'''"
|
||||
@@ -84,28 +84,28 @@ rules:
|
||||
skip: "\\\\."
|
||||
rules:
|
||||
- constant.specialChar: "\\\\([\"'bfnrst\\x24\\\\]|u[a-fA-F0-9]{4})"
|
||||
|
||||
|
||||
# Slashy strings are left out, because they match in unwanted places pretty much all the time
|
||||
# Dollar-slashy strings
|
||||
- constant.string:
|
||||
start: "[$]/"
|
||||
end: "/[$]"
|
||||
rules: []
|
||||
|
||||
|
||||
# Single-line comments
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
||||
# Multiline comments
|
||||
- comment:
|
||||
start: "/[*]"
|
||||
end: "[*]/"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
||||
# Groovydoc comments
|
||||
- comment:
|
||||
start: "/[*][*]@?"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
filetype: html4
|
||||
|
||||
detect:
|
||||
detect:
|
||||
filename: "\\.htm[l]?4$"
|
||||
header: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN|http://www.w3.org/TR/html4/strict.dtd\">"
|
||||
|
||||
@@ -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: "<"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
filetype: html5
|
||||
|
||||
detect:
|
||||
detect:
|
||||
filename: "\\.htm[l]?5$"
|
||||
header: "<!DOCTYPE html5>"
|
||||
|
||||
@@ -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: "<"
|
||||
|
||||
@@ -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):?"
|
||||
|
||||
|
||||
@@ -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=\"\\?>"
|
||||
|
||||
@@ -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: "\"\"\""
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -11,14 +11,14 @@ rules:
|
||||
rules:
|
||||
- error: "<[^!].*?>"
|
||||
- symbol.tag: "(?i)<[/]?(a|a(bbr|ddress|rea|rticle|side|udio)|b|b(ase|d(i|o)|lockquote|r|utton)|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata|atalist|d|el|etails|fn|ialog|l|t)|em|embed|fieldset|fig(caption|ure)|form|iframe|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li|link|ma(in|p|rk)|menu|menuitem|met(a|er)|nav|noscript|o(bject|l|pt(group|ion)|utput)|p|param|picture|pre|progress|q|r(p|t|uby)|s|samp|se(ction|lect)|svg|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u|ul|var|video|wbr)( .*)*?>"
|
||||
- symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*)*?>"
|
||||
- symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*)*?>"
|
||||
- preproc: "(?i)<[/]?(script|style)( .*)*?>"
|
||||
- special: "&[^;[[:space:]]]*;"
|
||||
|
||||
|
||||
- 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)://[^ ]+"
|
||||
@@ -41,27 +41,24 @@ rules:
|
||||
- symbol.tag.extended: "(?i)<[/]?(router-link|router-view)\\b"
|
||||
- identifier: "(to|v-slot)="
|
||||
- symbol: "[:=]"
|
||||
|
||||
|
||||
- default:
|
||||
|
||||
- default:
|
||||
start: "<script>"
|
||||
end: "</script>"
|
||||
limit-group: symbol.tag
|
||||
rules:
|
||||
- include: "javascript"
|
||||
|
||||
- default:
|
||||
- default:
|
||||
start: "<script[ ]+lang=(\"ts\"|'ts')>"
|
||||
end: "</script>"
|
||||
rules:
|
||||
- include: "typescript"
|
||||
|
||||
|
||||
- default:
|
||||
start: "<style.*?>"
|
||||
end: "</style.*?>"
|
||||
limit-group: symbol.tag
|
||||
rules:
|
||||
- include: "css"
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user