summary refs log tree commit diff
diff options
context:
space:
mode:
authorZach DeCook <zach.decook@bettercarpeople.com>2023-06-27 19:59:40 -0400
committerZach DeCook <zach.decook@bettercarpeople.com>2023-06-27 19:59:40 -0400
commit368e163aeb3e10a48d124924cb2f8c38b2b5ab98 (patch)
tree959f82643f28c388ea9b204359a0e99a00f2bcfb
parent65eb09b7090ac8a0d55c874ce8fc2d878dc661a7 (diff)
downloaddotfiles-368e163aeb3e10a48d124924cb2f8c38b2b5ab98.tar.gz
micro: add more complex php syntax
-rw-r--r--.config/micro/syntax/php.yaml55
1 files changed, 55 insertions, 0 deletions
diff --git a/.config/micro/syntax/php.yaml b/.config/micro/syntax/php.yaml
new file mode 100644
index 0000000..1d4bb9e
--- /dev/null
+++ b/.config/micro/syntax/php.yaml
@@ -0,0 +1,55 @@
+filetype: php
+
+detect:
+    filename: "\\.(php|module|install|theme|inc)$"
+
+rules:
+    - symbol.operator: "<|>"
+    - error: "<[^!].*?>"
+    - symbol.tag: "(?i)<[/]?(a(bbr|cronym|ddress|pplet|rea|rticle|side|udio)?|b(ase(font)?|d(i|o)|ig|lockquote|r)?|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata(list)?|d|el|etails|fn|ialog|ir|l|t)|em(bed)?|fieldset|fig(caption|ure)|font|form|(i)?frame|frameset|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li(nk)?|ma(in|p|rk)|menu(item)?|met(a|er)|nav|no(frames|script)|o(l|pt(group|ion)|utput)|p(aram|icture|re|rogress)?|q|r(p|t|uby)|s(trike)?|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u(l)?|var|video|wbr)( .*|>)*?>"
+    - 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:]]]*;"
+    - 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.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ 	]+"
+    - comment: "<!--.+?-->"
+    - default: "<\\?(php|=)\" end=\"\\?>"
+    - identifier.class: "([a-zA-Z0-9_-]+)\\("
+    - type: "\\b(array|bool(ean)?|callable|callback|float|int(eger)?|iterable|object|resource|mixed|string|void)\\b"
+    - identifier.class: "[a-zA-Z\\\\]+::"
+    - identifier: "\\b([A-Z][a-zA-Z0-9_]+)\\b"
+    - identifier: "([A-Z0-9_]+)[;|\\s|\\)|,]"
+    - type.keyword: "\\b(global|final|public|private|protected|static|const|var)\\b"
+    - statement: "\\b(abstract|catch|class|declare|do|else(if)?|end(declare|for(each)?|if|switch|while)|finally|for(each)|function|if|interface|namespace|switch|trait|try|while)\\b"
+    - identifier: "\\bnew\\s+([a-zA-Z0-9\\\\]+)"
+    - special: "\\b(as|and|break|case|clone|continue|default|die|fn|echo|empty|eval|exit|extends|goto|or|include(_once)?|implements|instanceof|insteadof|isset|list|new|print|return|require(_once)?|unset|use|throw|xor|yield(\\s+from))\\b"
+    - constant.bool: "\\b(true|false|null|TRUE|FALSE|NULL)\\b"
+    - constant: "[\\s|=|\\s|\\(|/|+|-|\\*|\\[]"
+    - constant.number: "[0-9]"
+    - identifier: "(\\$this|parent|self|\\$this->)"
+    - symbol.operator: "(=>|===|!==|==|!=|&&|\\|\\||::|=|->|\\!)"
+    - identifier.var: "(\\$[a-zA-Z0-9\\-_]+)"
+    - symbol.operator: "[\\(|\\)|/|+|\\-|\\*|\\[|.|,|;]"
+    # - constant.string:
+        # start: "\""
+        # end: "\""
+        # # skip: "\\\\."
+        # rules:
+            # - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
+            # - identifier.var: "\\$[a-zA-Z0-9-_]+"
+            # #- identifier.var: "{[^\\}]*}"
+    - constant.string: "(\\\"[^\\\"]*\\\")" # Double Quoted Strings
+    - constant.string: "('[^']*')" # Single Quoted Strings
+    - symbol.brackets: "(\\[|\\]|\\{|\\}|[()])"
+    - comment: "(^|[[:space:]])//.*"
+    - comment: "(^|[[:space:]])#.*"
+    - comment:
+        start: "/\\*"
+        end: "\\*/"
+        rules: []
+
+    - preproc: "<\\?(php|=)?"
+    - preproc: "\\?>"
+    - preproc: "<!DOCTYPE.+?>"