regular expressions (javascript).cson 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. 'scopeName': 'source.js.regexp'
  2. 'patterns': [
  3. {
  4. 'include': '#regexp'
  5. }
  6. ]
  7. 'repository':
  8. 'regex-character-class':
  9. 'patterns': [
  10. {
  11. 'match': '\\\\[wWsSdDtrnvf]|\\.'
  12. 'name': 'constant.character.character-class.regexp'
  13. }
  14. {
  15. 'match': '\\\\([0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4})'
  16. 'name': 'constant.character.numeric.regexp'
  17. }
  18. {
  19. 'match': '\\\\c[A-Z]'
  20. 'name': 'constant.character.control.regexp'
  21. }
  22. {
  23. 'match': '\\\\.'
  24. 'name': 'constant.character.escape.backslash.regexp'
  25. }
  26. ]
  27. 'regexp':
  28. 'patterns': [
  29. {
  30. 'match': '\\\\[bB]|\\^|\\$'
  31. 'name': 'keyword.control.anchor.regexp'
  32. }
  33. {
  34. 'match': '\\\\[1-9]\\d*|\\\\k<[a-zA-Z_$][\\w$]*>'
  35. 'name': 'keyword.other.back-reference.regexp'
  36. }
  37. {
  38. 'match': '[?+*]|\\{(\\d+,\\d+|\\d+,|,\\d+|\\d+)\\}\\??'
  39. 'name': 'keyword.operator.quantifier.regexp'
  40. }
  41. {
  42. 'match': '\\|'
  43. 'name': 'keyword.operator.or.regexp'
  44. }
  45. {
  46. 'begin': '(\\()(?:(\\?=)|(\\?!)|(\\?<=)|(\\?<!))'
  47. 'beginCaptures':
  48. '1':
  49. 'name': 'punctuation.definition.group.regexp'
  50. '2':
  51. 'name': 'meta.assertion.look-ahead.regexp'
  52. '3':
  53. 'name': 'meta.assertion.negative-look-ahead.regexp'
  54. '4':
  55. 'name': 'meta.assertion.look-behind.regexp'
  56. '5':
  57. 'name': 'meta.assertion.negative-look-behind.regexp'
  58. 'end': '(\\))'
  59. 'endCaptures':
  60. '1':
  61. 'name': 'punctuation.definition.group.regexp'
  62. 'name': 'meta.group.assertion.regexp'
  63. 'patterns': [
  64. {
  65. 'include': '#regexp'
  66. }
  67. ]
  68. }
  69. {
  70. 'begin': '\\(((\\?:)|(\\?<[a-zA-Z_$][\\w$]*>))?'
  71. 'beginCaptures':
  72. '0':
  73. 'name': 'punctuation.definition.group.regexp'
  74. 'end': '\\)'
  75. 'endCaptures':
  76. '0':
  77. 'name': 'punctuation.definition.group.regexp'
  78. 'name': 'meta.group.regexp'
  79. 'patterns': [
  80. {
  81. 'include': '#regexp'
  82. }
  83. ]
  84. }
  85. {
  86. 'begin': '(\\[)(\\^)?'
  87. 'beginCaptures':
  88. '1':
  89. 'name': 'punctuation.definition.character-class.regexp'
  90. '2':
  91. 'name': 'keyword.operator.negation.regexp'
  92. 'end': '(\\])'
  93. 'endCaptures':
  94. '1':
  95. 'name': 'punctuation.definition.character-class.regexp'
  96. 'name': 'constant.other.character-class.set.regexp'
  97. 'patterns': [
  98. {
  99. 'captures':
  100. '1':
  101. 'name': 'constant.character.numeric.regexp'
  102. '2':
  103. 'name': 'constant.character.control.regexp'
  104. '3':
  105. 'name': 'constant.character.escape.backslash.regexp'
  106. '4':
  107. 'name': 'constant.character.numeric.regexp'
  108. '5':
  109. 'name': 'constant.character.control.regexp'
  110. '6':
  111. 'name': 'constant.character.escape.backslash.regexp'
  112. 'match': '(?:.|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\c[A-Z])|(\\\\.))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\c[A-Z])|(\\\\.))'
  113. 'name': 'constant.other.character-class.range.regexp'
  114. }
  115. {
  116. 'include': '#regex-character-class'
  117. }
  118. ]
  119. }
  120. {
  121. 'include': '#regex-character-class'
  122. }
  123. ]