]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/php.yaml
PHP: Add enum and keyword, and modify types (#2204)
[micro.git] / runtime / syntax / php.yaml
1 filetype: php
2
3 detect:
4     filename: "\\.php[2345s~]?$"
5
6 rules:
7     - symbol.operator: "<|>"
8     - error: "<[^!].*?>"
9     - 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)( .*|>)*?>"
10     - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*|>)*?>"
11     - preproc: "(?i)<[/]?(script|style)( .*|>)*?>"
12     - special: "&[^;[[:space:]]]*;"
13     - symbol: "[:=]"
14     - identifier: "(alt|bgcolor|height|href|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)="
15     - constant.number: "(?i)#[0-9A-F]{6,6}"
16     - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^  ]+"
17     - comment: "<!--.+?-->"
18     - default: "<\\?(php|=)\" end=\"\\?>"
19     - identifier.class: "([a-zA-Z0-9_-]+)\\("
20     - type: "\\b(array|bool|callable|float|int|iterable|object|mixed|string|void)\\b"
21     - identifier.class: "[a-zA-Z\\\\]+::"
22     - identifier: "\\b([A-Z][a-zA-Z0-9_]+)\\b"
23     - identifier: "([A-Z0-9_]+)[;|\\s|\\)|,]"
24     - type.keyword: "\\b(global|final|public|private|protected|static|const|var)\\b"
25     - statement: "\\b(abstract|catch|class|declare|do|else(if)?|end(declare|for(each)?|if|switch|while)|enum|finally|for(each)|function|if|interface|namespace|switch|trait|try|while)\\b"
26     - identifier: "\\bnew\\s+([a-zA-Z0-9\\\\]+)"
27     - 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|match|new|print|return|require(_once)?|unset|use|throw|xor|yield(\\s+from))\\b"
28     - constant.bool: "\\b(true|false|null|TRUE|FALSE|NULL)\\b"
29     - constant: "[\\s|=|\\s|\\(|/|+|-|\\*|\\[]"
30     - constant.number: "[0-9]"
31     - identifier: "(\\$this|parent|self|\\$this->)"
32     - symbol.operator: "(=>|===|!==|==|!=|&&|\\|\\||::|=|->|\\!)"
33     - identifier.var: "(\\$[a-zA-Z0-9\\-_]+)"
34     - symbol.operator: "[\\(|\\)|/|+|\\-|\\*|\\[|.|,|;]"
35     - constant.string:
36         start: "\""
37         end: "\""
38         skip: "\\\\."
39         rules:
40             - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
41     - constant.string:
42         start: "\'"
43         end: "\'"
44         skip: "\\\\."
45         rules:
46             - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
47     - symbol.brackets: "(\\[|\\]|\\{|\\}|[()])"
48     - comment: "(^|[[:space:]])//.*"
49     - comment: "(^|[[:space:]])#.*"
50     - comment:
51         start: "/\\*"
52         end: "\\*/"
53         rules: []
54
55     - preproc: "<\\?(php|=)?"
56     - preproc: "\\?>"
57     - preproc: "<!DOCTYPE.+?>"