brainfuck.js 690 B

123456789101112131415161718192021222324252627282930313233343536
  1. module.exports = function(hljs){
  2. var LITERAL = {
  3. className: 'literal',
  4. begin: '[\\+\\-]',
  5. relevance: 0
  6. };
  7. return {
  8. aliases: ['bf'],
  9. contains: [
  10. hljs.COMMENT(
  11. '[^\\[\\]\\.,\\+\\-<> \r\n]',
  12. '[\\[\\]\\.,\\+\\-<> \r\n]',
  13. {
  14. returnEnd: true,
  15. relevance: 0
  16. }
  17. ),
  18. {
  19. className: 'title',
  20. begin: '[\\[\\]]',
  21. relevance: 0
  22. },
  23. {
  24. className: 'string',
  25. begin: '[\\.,]',
  26. relevance: 0
  27. },
  28. {
  29. // this mode works as the only relevance counter
  30. begin: /(?:\+\+|\-\-)/,
  31. contains: [LITERAL]
  32. },
  33. LITERAL
  34. ]
  35. };
  36. };