CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
makefile.js90 linesDownload Raw Back to languages
1/*2Language: Makefile3Author: Ivan Sagalaev <maniac@softwaremaniacs.org>4Contributors: Joël Porquet <joel@porquet.org>5Website: https://www.gnu.org/software/make/manual/html_node/Introduction.html6Category: common, build-system7*/8 9function makefile(hljs) {10  /* Variables: simple (eg $(var)) and special (eg $@) */11  const VARIABLE = {12    className: 'variable',13    variants: [14      {15        begin: '\\$\\(' + hljs.UNDERSCORE_IDENT_RE + '\\)',16        contains: [ hljs.BACKSLASH_ESCAPE ]17      },18      { begin: /\$[@%<?\^\+\*]/ }19    ]20  };21  /* Quoted string with variables inside */22  const QUOTE_STRING = {23    className: 'string',24    begin: /"/,25    end: /"/,26    contains: [27      hljs.BACKSLASH_ESCAPE,28      VARIABLE29    ]30  };31  /* Function: $(func arg,...) */32  const FUNC = {33    className: 'variable',34    begin: /\$\([\w-]+\s/,35    end: /\)/,36    keywords: { built_in:37        'subst patsubst strip findstring filter filter-out sort '38        + 'word wordlist firstword lastword dir notdir suffix basename '39        + 'addsuffix addprefix join wildcard realpath abspath error warning '40        + 'shell origin flavor foreach if or and call eval file value' },41    contains: [ 42      VARIABLE,43      QUOTE_STRING // Added QUOTE_STRING as they can be a part of functions44    ]45  };46  /* Variable assignment */47  const ASSIGNMENT = { begin: '^' + hljs.UNDERSCORE_IDENT_RE + '\\s*(?=[:+?]?=)' };48  /* Meta targets (.PHONY) */49  const META = {50    className: 'meta',51    begin: /^\.PHONY:/,52    end: /$/,53    keywords: {54      $pattern: /[\.\w]+/,55      keyword: '.PHONY'56    }57  };58  /* Targets */59  const TARGET = {60    className: 'section',61    begin: /^[^\s]+:/,62    end: /$/,63    contains: [ VARIABLE ]64  };65  return {66    name: 'Makefile',67    aliases: [68      'mk',69      'mak',70      'make',71    ],72    keywords: {73      $pattern: /[\w-]+/,74      keyword: 'define endef undefine ifdef ifndef ifeq ifneq else endif '75      + 'include -include sinclude override export unexport private vpath'76    },77    contains: [78      hljs.HASH_COMMENT_MODE,79      VARIABLE,80      QUOTE_STRING,81      FUNC,82      ASSIGNMENT,83      META,84      TARGET85    ]86  };87}88 89export { makefile as default };90 
basant307/AI_Governance_Project · CoolFace