makefile.js 994 B

12345678910111213141516171819202122232425262728293031
  1. Prism.languages.makefile = {
  2. 'comment': {
  3. pattern: /(^|[^\\])#(?:\\(?:\r\n|[\s\S])|.)*/,
  4. lookbehind: true
  5. },
  6. 'string': /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  7. // Built-in target names
  8. 'builtin': /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,
  9. // Targets
  10. 'symbol': {
  11. pattern: /^[^:=\r\n]+(?=\s*:(?!=))/m,
  12. inside: {
  13. 'variable': /\$+(?:[^(){}:#=\s]+|(?=[({]))/
  14. }
  15. },
  16. 'variable': /\$+(?:[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,
  17. 'keyword': [
  18. // Directives
  19. /-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,
  20. // Functions
  21. {
  22. pattern: /(\()(?:addsuffix|abspath|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:s|list)?)(?=[ \t])/,
  23. lookbehind: true
  24. }
  25. ],
  26. 'operator': /(?:::|[?:+!])?=|[|@]/,
  27. 'punctuation': /[:;(){}]/
  28. };