prism-c.js 1009 B

1234567891011121314151617181920212223242526
  1. Prism.languages.c = Prism.languages.extend('clike', {
  2. // allow for c multiline strings
  3. 'string': /("|')([^\n\\\1]|\\.|\\\r*\n)*?\1/,
  4. 'keyword': /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
  5. 'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\//
  6. });
  7. Prism.languages.insertBefore('c', 'string', {
  8. // property class reused for macro statements
  9. 'property': {
  10. // allow for multiline macro definitions
  11. // spaces after the # character compile fine with gcc
  12. pattern: /((^|\n)\s*)#\s*[a-z]+([^\n\\]|\\.|\\\r*\n)*/i,
  13. lookbehind: true,
  14. inside: {
  15. // highlight the path of the include statement as a string
  16. 'string': {
  17. pattern: /(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,
  18. lookbehind: true
  19. }
  20. }
  21. }
  22. });
  23. delete Prism.languages.c['class-name'];
  24. delete Prism.languages.c['boolean'];