hide-semicolons.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. var colors = require('ansicolors');
  2. // Change the below definitions in order to tweak the color theme.
  3. module.exports = {
  4. 'Boolean': {
  5. 'true' : undefined
  6. , 'false' : undefined
  7. , _default : colors.brightRed
  8. }
  9. , 'Identifier': {
  10. 'undefined' : colors.brightBlack
  11. , 'self' : colors.brightRed
  12. , 'console' : colors.blue
  13. , 'log' : colors.blue
  14. , 'warn' : colors.red
  15. , 'error' : colors.brightRed
  16. , _default : colors.white
  17. }
  18. , 'Null': {
  19. _default: colors.brightBlack
  20. }
  21. , 'Numeric': {
  22. _default: colors.blue
  23. }
  24. , 'String': {
  25. _default: function (s, info) {
  26. var nextToken = info.tokens[info.tokenIndex + 1];
  27. // show keys of object literals and json in different color
  28. return (nextToken && nextToken.type === 'Punctuator' && nextToken.value === ':')
  29. ? colors.green(s)
  30. : colors.brightGreen(s);
  31. }
  32. }
  33. , 'Keyword': {
  34. 'break' : undefined
  35. , 'case' : undefined
  36. , 'catch' : colors.cyan
  37. , 'continue' : undefined
  38. , 'debugger' : undefined
  39. , 'default' : undefined
  40. , 'delete' : colors.red
  41. , 'do' : undefined
  42. , 'else' : undefined
  43. , 'finally' : colors.cyan
  44. , 'for' : undefined
  45. , 'function' : undefined
  46. , 'if' : undefined
  47. , 'in' : undefined
  48. , 'instanceof' : undefined
  49. , 'new' : colors.red
  50. , 'return' : colors.red
  51. , 'switch' : undefined
  52. , 'this' : colors.brightRed
  53. , 'throw' : undefined
  54. , 'try' : colors.cyan
  55. , 'typeof' : undefined
  56. , 'var' : colors.green
  57. , 'void' : undefined
  58. , 'while' : undefined
  59. , 'with' : undefined
  60. , _default : colors.brightBlue
  61. }
  62. , 'Punctuator': {
  63. // setting semicolon's color to the same as the terminal background makes it invisible
  64. ';': colors.black
  65. , '.': colors.green
  66. , ',': colors.green
  67. , '{': colors.yellow
  68. , '}': colors.yellow
  69. , '(': colors.brightBlack
  70. , ')': colors.brightBlack
  71. , '[': colors.yellow
  72. , ']': colors.yellow
  73. , '<': undefined
  74. , '>': undefined
  75. , '+': undefined
  76. , '-': undefined
  77. , '*': undefined
  78. , '%': undefined
  79. , '&': undefined
  80. , '|': undefined
  81. , '^': undefined
  82. , '!': undefined
  83. , '~': undefined
  84. , '?': undefined
  85. , ':': undefined
  86. , '=': undefined
  87. , '<=': undefined
  88. , '>=': undefined
  89. , '==': undefined
  90. , '!=': undefined
  91. , '++': undefined
  92. , '--': undefined
  93. , '<<': undefined
  94. , '>>': undefined
  95. , '&&': undefined
  96. , '||': undefined
  97. , '+=': undefined
  98. , '-=': undefined
  99. , '*=': undefined
  100. , '%=': undefined
  101. , '&=': undefined
  102. , '|=': undefined
  103. , '^=': undefined
  104. , '/=': undefined
  105. , '===': undefined
  106. , '!==': undefined
  107. , '>>>': undefined
  108. , '<<=': undefined
  109. , '>>=': undefined
  110. , '>>>=': undefined
  111. , _default: colors.brightYellow
  112. }
  113. // line comment
  114. , Line: {
  115. _default: colors.brightBlack
  116. }
  117. /* block comment */
  118. , Block: {
  119. _default: colors.brightBlack
  120. }
  121. , _default: undefined
  122. };