prism-makefile.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. Prism.languages.makefile = {
  2. 'comment': {
  3. pattern: /(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,
  4. lookbehind: true
  5. },
  6. 'string': {
  7. pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  8. greedy: true
  9. },
  10. 'builtin-target': {
  11. pattern: /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,
  12. alias: 'builtin'
  13. },
  14. 'target': {
  15. pattern: /^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,
  16. alias: 'symbol',
  17. inside: {
  18. 'variable': /\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/
  19. }
  20. },
  21. 'variable': /\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,
  22. // Directives
  23. 'keyword': /-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,
  24. 'function': {
  25. pattern: /(\()(?:abspath|addsuffix|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(?:list|s)?)(?=[ \t])/,
  26. lookbehind: true
  27. },
  28. 'operator': /(?:::|[?:+!])?=|[|@]/,
  29. 'punctuation': /[:;(){}]/
  30. };