hide-semicolons.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. , 'class' : undefined
  38. , 'const' : undefined
  39. , 'continue' : undefined
  40. , 'debugger' : undefined
  41. , 'default' : undefined
  42. , 'delete' : colors.red
  43. , 'do' : undefined
  44. , 'else' : undefined
  45. , 'enum' : undefined
  46. , 'export' : undefined
  47. , 'extends' : undefined
  48. , 'finally' : colors.cyan
  49. , 'for' : undefined
  50. , 'function' : undefined
  51. , 'if' : undefined
  52. , 'implements' : undefined
  53. , 'import' : undefined
  54. , 'in' : undefined
  55. , 'instanceof' : undefined
  56. , 'let' : undefined
  57. , 'new' : colors.red
  58. , 'package' : undefined
  59. , 'private' : undefined
  60. , 'protected' : undefined
  61. , 'public' : undefined
  62. , 'return' : colors.red
  63. , 'static' : undefined
  64. , 'super' : undefined
  65. , 'switch' : undefined
  66. , 'this' : colors.brightRed
  67. , 'throw' : undefined
  68. , 'try' : colors.cyan
  69. , 'typeof' : undefined
  70. , 'var' : colors.green
  71. , 'void' : undefined
  72. , 'while' : undefined
  73. , 'with' : undefined
  74. , 'yield' : undefined
  75. , _default : colors.brightBlue
  76. }
  77. , 'Punctuator': {
  78. // setting semicolon's color to the same as the terminal background makes it invisible
  79. ';': colors.black
  80. , '.': colors.green
  81. , ',': colors.green
  82. , '{': colors.yellow
  83. , '}': colors.yellow
  84. , '(': colors.brightBlack
  85. , ')': colors.brightBlack
  86. , '[': colors.yellow
  87. , ']': colors.yellow
  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. , '||': undefined
  112. , '+=': undefined
  113. , '-=': undefined
  114. , '*=': undefined
  115. , '%=': undefined
  116. , '&=': undefined
  117. , '|=': undefined
  118. , '^=': undefined
  119. , '/=': undefined
  120. , '=>': undefined
  121. , '===': undefined
  122. , '!==': undefined
  123. , '>>>': undefined
  124. , '<<=': undefined
  125. , '>>=': undefined
  126. , '...': undefined
  127. , '>>>=': undefined
  128. , _default: colors.brightYellow
  129. }
  130. // line comment
  131. , Line: {
  132. _default: colors.brightBlack
  133. }
  134. /* block comment */
  135. , Block: {
  136. _default: colors.brightBlack
  137. }
  138. , _default: undefined
  139. };