From: USAMI Kenta Date: Sun, 17 Jul 2022 19:16:17 +0000 (+0900) Subject: PHP: Add enum and keyword, and modify types (#2204) X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=37ed9dfe1eb06dff0c36c35e51ec80ed4351c861;p=micro.git PHP: Add enum and keyword, and modify types (#2204) * Add enum keyword to PHP (8.1) syntax * Specify only keywords that are valid as type declarations as PHP types boolean, integer and resource are not valid type name. * Add match keyword to PHP (8.2) syntax --- diff --git a/runtime/syntax/php.yaml b/runtime/syntax/php.yaml index 56b003f2..a4e20dec 100644 --- a/runtime/syntax/php.yaml +++ b/runtime/syntax/php.yaml @@ -17,14 +17,14 @@ rules: - 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" + - type: "\\b(array|bool|callable|float|int|iterable|object|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" + - 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" - 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" + - 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" - constant.bool: "\\b(true|false|null|TRUE|FALSE|NULL)\\b" - constant: "[\\s|=|\\s|\\(|/|+|-|\\*|\\[]" - constant.number: "[0-9]"