CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
leaf.js98 linesDownload Raw Back to languages
1/*2Language: Leaf3Description: A Swift-based templating language created for the Vapor project.4Website: https://docs.vapor.codes/leaf/overview5Category: template6*/7 8function leaf(hljs) {9  const IDENT = /([A-Za-z_][A-Za-z_0-9]*)?/;10  const LITERALS = [11    'true',12    'false',13    'in'14  ];15  const PARAMS = {16    scope: 'params',17    begin: /\(/,18    end: /\)(?=\:?)/,19    endsParent: true,20    relevance: 7,21    contains: [22      {23        scope: 'string',24        begin: '"',25        end: '"'26      },27      {28        scope: 'keyword',29        match: LITERALS.join("|"),30      },31      {32        scope: 'variable',33        match: /[A-Za-z_][A-Za-z_0-9]*/34      },35      {36        scope: 'operator',37        match: /\+|\-|\*|\/|\%|\=\=|\=|\!|\>|\<|\&\&|\|\|/38      }39    ]40  };41  const INSIDE_DISPATCH = {42    match: [43      IDENT,44      /(?=\()/,45    ],46    scope: {47      1: "keyword"48    },49    contains: [ PARAMS ]50  };51  PARAMS.contains.unshift(INSIDE_DISPATCH);52  return {53    name: 'Leaf',54    contains: [55      // #ident():56      {57        match: [58          /#+/,59          IDENT,60          /(?=\()/,61        ],62        scope: {63          1: "punctuation",64          2: "keyword"65        },66        // will start up after the ending `)` match from line ~4467        // just to grab the trailing `:` if we can match it68        starts: {69          contains: [70            {71              match: /\:/,72              scope: "punctuation"73            }74          ]75        },76        contains: [77          PARAMS78        ],79      },80      // #ident or #ident:81      {82        match: [83          /#+/,84          IDENT,85          /:?/,86        ],87        scope: {88          1: "punctuation",89          2: "keyword",90          3: "punctuation"91        }92      },93    ]94  };95}96 97export { leaf as default };98 
basant307/AI_Governance_Project · CoolFace