CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
hy.js138 linesDownload Raw Back to languages
1/*2Language: Hy3Description: Hy is a wonderful dialect of Lisp that’s embedded in Python.4Author: Sergey Sobko <s.sobko@profitware.ru>5Website: http://docs.hylang.org/en/stable/6Category: lisp7*/8 9function hy(hljs) {10  const SYMBOLSTART = 'a-zA-Z_\\-!.?+*=<>&#\'';11  const SYMBOL_RE = '[' + SYMBOLSTART + '][' + SYMBOLSTART + '0-9/;:]*';12  const keywords = {13    $pattern: SYMBOL_RE,14    built_in:15      // keywords16      '!= % %= & &= * ** **= *= *map '17      + '+ += , --build-class-- --import-- -= . / // //= '18      + '/= < << <<= <= = > >= >> >>= '19      + '@ @= ^ ^= abs accumulate all and any ap-compose '20      + 'ap-dotimes ap-each ap-each-while ap-filter ap-first ap-if ap-last ap-map ap-map-when ap-pipe '21      + 'ap-reduce ap-reject apply as-> ascii assert assoc bin break butlast '22      + 'callable calling-module-name car case cdr chain chr coll? combinations compile '23      + 'compress cond cons cons? continue count curry cut cycle dec '24      + 'def default-method defclass defmacro defmacro-alias defmacro/g! defmain defmethod defmulti defn '25      + 'defn-alias defnc defnr defreader defseq del delattr delete-route dict-comp dir '26      + 'disassemble dispatch-reader-macro distinct divmod do doto drop drop-last drop-while empty? '27      + 'end-sequence eval eval-and-compile eval-when-compile even? every? except exec filter first '28      + 'flatten float? fn fnc fnr for for* format fraction genexpr '29      + 'gensym get getattr global globals group-by hasattr hash hex id '30      + 'identity if if* if-not if-python2 import in inc input instance? '31      + 'integer integer-char? integer? interleave interpose is is-coll is-cons is-empty is-even '32      + 'is-every is-float is-instance is-integer is-integer-char is-iterable is-iterator is-keyword is-neg is-none '33      + 'is-not is-numeric is-odd is-pos is-string is-symbol is-zero isinstance islice issubclass '34      + 'iter iterable? iterate iterator? keyword keyword? lambda last len let '35      + 'lif lif-not list* list-comp locals loop macro-error macroexpand macroexpand-1 macroexpand-all '36      + 'map max merge-with method-decorator min multi-decorator multicombinations name neg? next '37      + 'none? nonlocal not not-in not? nth numeric? oct odd? open '38      + 'or ord partition permutations pos? post-route postwalk pow prewalk print '39      + 'product profile/calls profile/cpu put-route quasiquote quote raise range read read-str '40      + 'recursive-replace reduce remove repeat repeatedly repr require rest round route '41      + 'route-with-methods rwm second seq set-comp setattr setv some sorted string '42      + 'string? sum switch symbol? take take-nth take-while tee try unless '43      + 'unquote unquote-splicing vars walk when while with with* with-decorator with-gensyms '44      + 'xi xor yield yield-from zero? zip zip-longest | |= ~'45  };46 47  const SIMPLE_NUMBER_RE = '[-+]?\\d+(\\.\\d+)?';48 49  const SYMBOL = {50    begin: SYMBOL_RE,51    relevance: 052  };53  const NUMBER = {54    className: 'number',55    begin: SIMPLE_NUMBER_RE,56    relevance: 057  };58  const STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, { illegal: null });59  const COMMENT = hljs.COMMENT(60    ';',61    '$',62    { relevance: 0 }63  );64  const LITERAL = {65    className: 'literal',66    begin: /\b([Tt]rue|[Ff]alse|nil|None)\b/67  };68  const COLLECTION = {69    begin: '[\\[\\{]',70    end: '[\\]\\}]',71    relevance: 072  };73  const HINT = {74    className: 'comment',75    begin: '\\^' + SYMBOL_RE76  };77  const HINT_COL = hljs.COMMENT('\\^\\{', '\\}');78  const KEY = {79    className: 'symbol',80    begin: '[:]{1,2}' + SYMBOL_RE81  };82  const LIST = {83    begin: '\\(',84    end: '\\)'85  };86  const BODY = {87    endsWithParent: true,88    relevance: 089  };90  const NAME = {91    className: 'name',92    relevance: 0,93    keywords: keywords,94    begin: SYMBOL_RE,95    starts: BODY96  };97  const DEFAULT_CONTAINS = [98    LIST,99    STRING,100    HINT,101    HINT_COL,102    COMMENT,103    KEY,104    COLLECTION,105    NUMBER,106    LITERAL,107    SYMBOL108  ];109 110  LIST.contains = [111    hljs.COMMENT('comment', ''),112    NAME,113    BODY114  ];115  BODY.contains = DEFAULT_CONTAINS;116  COLLECTION.contains = DEFAULT_CONTAINS;117 118  return {119    name: 'Hy',120    aliases: [ 'hylang' ],121    illegal: /\S/,122    contains: [123      hljs.SHEBANG(),124      LIST,125      STRING,126      HINT,127      HINT_COL,128      COMMENT,129      KEY,130      COLLECTION,131      NUMBER,132      LITERAL133    ]134  };135}136 137export { hy as default };138 
basant307/AI_Governance_Project · CoolFace