]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/zephir.js
1 /*! `zephir` grammar compiled for Highlight.js 11.11.1 */
3 var hljsGrammar
= ( function () {
8 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.
9 Author: Oleg Efimov <efimovov@gmail.com>
10 Website: https://zephir-lang.com/en
15 /** @type LanguageFn */
16 function zephir ( hljs
) {
19 contains : [ hljs
. BACKSLASH_ESCAPE
],
21 hljs
. inherit ( hljs
. APOS_STRING_MODE
, { illegal : null }),
22 hljs
. inherit ( hljs
. QUOTE_STRING_MODE
, { illegal : null })
25 const TITLE_MODE
= hljs
. UNDERSCORE_TITLE_MODE
;
26 const NUMBER
= { variants : [
27 hljs
. BINARY_NUMBER_MODE
,
31 // classes and objects
32 'namespace class interface use extends '
34 + 'abstract final public protected private static deprecated '
36 + 'throw try catch Exception '
37 // keyword-ish things their website does NOT seem to highlight (in their own snippets)
38 // 'typeof fetch in ' +
40 + 'echo empty isset instanceof unset '
41 // assignment/variables
42 + 'let var new const self '
45 + 'if else elseif switch case default '
46 + 'do while loop for continue break '
49 // https://github.com/phalcon/zephir/blob/master/Library/Expression/Constants.php
50 + '__LINE__ __FILE__ __DIR__ __FUNCTION__ __CLASS__ __TRAIT__ __METHOD__ __NAMESPACE__ '
51 // types - https://docs.zephir-lang.com/0.12/en/types
52 + 'array boolean float double integer object resource string '
53 + 'char long unsigned bool int uint ulong uchar '
55 + 'true false null undefined' ;
62 hljs
. C_LINE_COMMENT_MODE
,
75 begin : /<<<['"]?\w+['"]?$/ ,
77 contains : [ hljs
. BACKSLASH_ESCAPE
]
80 // swallow composed identifiers to avoid parsing them as keywords
81 begin : /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/ },
83 className : 'function' ,
84 beginKeywords : 'function fn' ,
97 hljs
. C_BLOCK_COMMENT_MODE
,
106 beginKeywords : 'class interface' ,
111 { beginKeywords : 'extends implements' },
116 beginKeywords : 'namespace' ,
119 contains : [ TITLE_MODE
]
122 beginKeywords : 'use' ,
124 contains : [ TITLE_MODE
]
126 { begin : /=>/ // No markup, just a relevance booster
138 hljs
. registerLanguage ( 'zephir' , hljsGrammar
);