]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/zephir.js
1 /*! `zephir` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar
= ( function () {
7 Description: Zephir, an open source, high-level language designed to ease the creation and maintainability of extensions for PHP with a focus on type and memory safety.
8 Author: Oleg Efimov <efimovov@gmail.com>
9 Website: https://zephir-lang.com/en
14 /** @type LanguageFn */
15 function zephir ( hljs
) {
18 contains : [ hljs
. BACKSLASH_ESCAPE
],
20 hljs
. inherit ( hljs
. APOS_STRING_MODE
, { illegal : null }),
21 hljs
. inherit ( hljs
. QUOTE_STRING_MODE
, { illegal : null })
24 const TITLE_MODE
= hljs
. UNDERSCORE_TITLE_MODE
;
25 const NUMBER
= { variants : [
26 hljs
. BINARY_NUMBER_MODE
,
30 // classes and objects
31 'namespace class interface use extends '
33 + 'abstract final public protected private static deprecated '
35 + 'throw try catch Exception '
36 // keyword-ish things their website does NOT seem to highlight (in their own snippets)
37 // 'typeof fetch in ' +
39 + 'echo empty isset instanceof unset '
40 // assignment/variables
41 + 'let var new const self '
44 + 'if else elseif switch case default '
45 + 'do while loop for continue break '
48 // https://github.com/phalcon/zephir/blob/master/Library/Expression/Constants.php
49 + '__LINE__ __FILE__ __DIR__ __FUNCTION__ __CLASS__ __TRAIT__ __METHOD__ __NAMESPACE__ '
50 // types - https://docs.zephir-lang.com/0.12/en/types
51 + 'array boolean float double integer object resource string '
52 + 'char long unsigned bool int uint ulong uchar '
54 + 'true false null undefined' ;
61 hljs
. C_LINE_COMMENT_MODE
,
74 begin : /<<<['"]?\w+['"]?$/ ,
76 contains : [ hljs
. BACKSLASH_ESCAPE
]
79 // swallow composed identifiers to avoid parsing them as keywords
80 begin : /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/ },
82 className : 'function' ,
83 beginKeywords : 'function fn' ,
96 hljs
. C_BLOCK_COMMENT_MODE
,
105 beginKeywords : 'class interface' ,
110 { beginKeywords : 'extends implements' },
115 beginKeywords : 'namespace' ,
118 contains : [ TITLE_MODE
]
121 beginKeywords : 'use' ,
123 contains : [ TITLE_MODE
]
125 { begin : /=>/ // No markup, just a relevance booster
137 export default hljsGrammar
;