CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
zephir.js130 linesDownload Raw Back to languages
1/*2 Language: Zephir3 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.4 Author: Oleg Efimov <efimovov@gmail.com>5 Website: https://zephir-lang.com/en6 Category: web7 Audit: 20208 */9 10/** @type LanguageFn */11function zephir(hljs) {12  const STRING = {13    className: 'string',14    contains: [ hljs.BACKSLASH_ESCAPE ],15    variants: [16      hljs.inherit(hljs.APOS_STRING_MODE, { illegal: null }),17      hljs.inherit(hljs.QUOTE_STRING_MODE, { illegal: null })18    ]19  };20  const TITLE_MODE = hljs.UNDERSCORE_TITLE_MODE;21  const NUMBER = { variants: [22    hljs.BINARY_NUMBER_MODE,23    hljs.C_NUMBER_MODE24  ] };25  const KEYWORDS =26    // classes and objects27    'namespace class interface use extends '28    + 'function return '29    + 'abstract final public protected private static deprecated '30    // error handling31    + 'throw try catch Exception '32    // keyword-ish things their website does NOT seem to highlight (in their own snippets)33    // 'typeof fetch in ' +34    // operators/helpers35    + 'echo empty isset instanceof unset '36    // assignment/variables37    + 'let var new const self '38    // control39    + 'require '40    + 'if else elseif switch case default '41    + 'do while loop for continue break '42    + 'likely unlikely '43    // magic constants44    // https://github.com/phalcon/zephir/blob/master/Library/Expression/Constants.php45    + '__LINE__ __FILE__ __DIR__ __FUNCTION__ __CLASS__ __TRAIT__ __METHOD__ __NAMESPACE__ '46    // types - https://docs.zephir-lang.com/0.12/en/types47    + 'array boolean float double integer object resource string '48    + 'char long unsigned bool int uint ulong uchar '49    // built-ins50    + 'true false null undefined';51 52  return {53    name: 'Zephir',54    aliases: [ 'zep' ],55    keywords: KEYWORDS,56    contains: [57      hljs.C_LINE_COMMENT_MODE,58      hljs.COMMENT(59        /\/\*/,60        /\*\//,61        { contains: [62          {63            className: 'doctag',64            begin: /@[A-Za-z]+/65          }66        ] }67      ),68      {69        className: 'string',70        begin: /<<<['"]?\w+['"]?$/,71        end: /^\w+;/,72        contains: [ hljs.BACKSLASH_ESCAPE ]73      },74      {75        // swallow composed identifiers to avoid parsing them as keywords76        begin: /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/ },77      {78        className: 'function',79        beginKeywords: 'function fn',80        end: /[;{]/,81        excludeEnd: true,82        illegal: /\$|\[|%/,83        contains: [84          TITLE_MODE,85          {86            className: 'params',87            begin: /\(/,88            end: /\)/,89            keywords: KEYWORDS,90            contains: [91              'self',92              hljs.C_BLOCK_COMMENT_MODE,93              STRING,94              NUMBER95            ]96          }97        ]98      },99      {100        className: 'class',101        beginKeywords: 'class interface',102        end: /\{/,103        excludeEnd: true,104        illegal: /[:($"]/,105        contains: [106          { beginKeywords: 'extends implements' },107          TITLE_MODE108        ]109      },110      {111        beginKeywords: 'namespace',112        end: /;/,113        illegal: /[.']/,114        contains: [ TITLE_MODE ]115      },116      {117        beginKeywords: 'use',118        end: /;/,119        contains: [ TITLE_MODE ]120      },121      { begin: /=>/ // No markup, just a relevance booster122      },123      STRING,124      NUMBER125    ]126  };127}128 129export { zephir as default };130 
basant307/AI_Governance_Project · CoolFace