Guest User

Untitled

a guest
Jul 31st, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.44 KB | None | 0 0
  1. { scopeName = 'source.ruby.experimental';
  2. comment = '
  3. TODO: unresolved issues
  4.  
  5. text:
  6. "p << end
  7. print me!
  8. end"
  9. symptoms:
  10. not recognized as a heredoc
  11. solution:
  12. there is no way to distinguish perfectly between the << operator and the start
  13. of a heredoc. Currently, we require assignment to recognize a heredoc. More
  14. refinement is possible.
  15. • Heredocs with indented terminators (<<-) are always distinguishable, however.
  16. • Nested heredocs are not really supportable at present
  17.  
  18. text:
  19. "a\332a"
  20. symptoms:
  21. ''\332'' is not recognized as slash3.. which should be octal 332.
  22. solution:
  23. plain regexp.. should be easy.
  24.  
  25. text:
  26. val?(a):p(b)
  27. val?''a'':''b''
  28. symptoms:
  29. '':p'' is recognized as a symbol.. its 2 things '':'' and ''p''.
  30. :''b'' has same problem.
  31. solution:
  32. ternary operator rule, precedence stuff, symbol rule.
  33. but also consider ''a.b?(:c)'' ??
  34. ';
  35. firstLineMatch = '^#!/.*\bruby\b';
  36. fileTypes = ( 'rb', 'rbx', 'Rakefile', 'rake', 'cgi', 'fcgi' );
  37. foldingStartMarker = '(?x)^
  38. (\s*
  39. (module|class|def
  40. |unless|if
  41. |case
  42. |begin
  43. |for|while|until
  44. |( "(\\.|[^"])* " # eat a double quoted string
  45. | ''(\\.|[^''])* '' # eat a single quoted string
  46. | [^#"''] # eat all but comments and strings
  47. )*
  48. ( \s (do|begin|case)
  49. | [- =&|*/~%^<>~] \s* (if|unless)
  50. )
  51. )\b
  52. (?! [^;]* ; .*? \bend\b )
  53. |( "(\\.|[^"])* " # eat a double quoted string
  54. | ''(\\.|[^''])* '' # eat a single quoted string
  55. | [^#"''] # eat all but comments and strings
  56. )*
  57. ( \{ (?! [^}]* \} )
  58. | \[ (?! [^\]]* \] )
  59. )
  60. ).*$
  61. | [#] .*? \(fold\) \s* $ # Sune’s special marker
  62. ';
  63. foldingStopMarker = '(?x)
  64. ( (^|;) \s* end \s* ([#].*)? $
  65. | ^ \s* [}\]] \s* ([#].*)? $
  66. | [#] .*? \(end\) \s* $ # Sune’s special marker
  67. )';
  68. patterns = (
  69. { name = 'declaration.class.ruby';
  70. match = '^\s*(class)\s (([.a-zA-Z0-9_:] (\s*<\s*[.a-zA-Z0-9_:] )?)|(<<\s*[.a-zA-Z0-9_:] ))';
  71. captures =
  72. { 1 = { name = 'keyword.control.class.ruby'; };
  73. 2 = { name = 'entity.name.class.ruby'; };
  74. 4 = { name = 'entity.other.inherited-class.ruby'; };
  75. 5 = { name = 'variable.other.object.ruby'; };
  76. };
  77. },
  78. { name = 'declaration.module.ruby';
  79. match = '^\s*(module)\s ((([A-Z]\w*::)*)[A-Z]\w*)';
  80. captures =
  81. { 1 = { name = 'keyword.control.module.ruby'; };
  82. 2 = { name = 'entity.name.module.ruby'; };
  83. 3 = { name = 'entity.other.parent-module.ruby'; };
  84. };
  85. },
  86. { name = 'keyword.control.ruby';
  87. comment = "everything being a reserved word, not a value and needing a 'end' is a..";
  88. match = '(?<!\.)\b(BEGIN|begin|case|class|else|elsif|END|end|ensure|for|if|in|module|rescue|then|unless|until|when|while)\b(?![?!])';
  89. },
  90. { name = 'keyword.control.ruby.start-block';
  91. comment = 'contextual smart pair support for block parameters';
  92. match = '(?<!\.)\bdo\b\s*';
  93. },
  94. { name = 'meta.syntax.ruby.start-block';
  95. comment = 'contextual smart pair support';
  96. match = '(?<=\{)(\s )';
  97. },
  98. { name = 'keyword.operator.logical.ruby';
  99. comment = " as above, just doesn't need a 'end' and does a logic operation";
  100. match = '(?<!\.)\b(and|not|or)\b';
  101. },
  102. { name = 'keyword.control.pseudo-method.ruby';
  103. comment = ' just as above but being not a logical operation';
  104. match = '(?<!\.)\b(alias|alias_method|break|next|redo|retry|return|super|undef|yield)\b(?![?!])|\bdefined\?';
  105. },
  106. { name = 'constant.language.pseudo-variable.ruby';
  107. comment = ' every reserved word, being a value is a..';
  108. match = '\b(nil|true|false|__(FILE|LINE)__|self)\b(?![?!])';
  109. },
  110. { name = 'keyword.other.special-method.ruby';
  111. comment = ' everything being a method but having a special function is a..';
  112. match = '\b(initialize|new|loop|include|require|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|public|protected)\b(?![?!])';
  113. },
  114. { name = 'variable.other.readwrite.instance.ruby';
  115. match = '@[a-zA-Z_]\w*';
  116. },
  117. { name = 'variable.other.readwrite.class.ruby';
  118. match = '@@[a-zA-Z_]\w*';
  119. },
  120. { name = 'variable.other.readwrite.global.ruby';
  121. match = '\$[a-zA-Z_]\w*';
  122. },
  123. { name = 'variable.other.readwrite.global.pre-defined.ruby';
  124. match = '\$(!|@|&|`|''|\ |\d|~|=|/|\\|,|;|\.|<|>|_|\*|\$|\?|:|"|-[0adFiIlpv])';
  125. },
  126. { name = 'variable.other.constant.ruby';
  127. match = '\b[A-Z]\w*\b';
  128. },
  129. { name = 'declaration.function.method.with-arguments.ruby';
  130. comment = ' the method pattern comes from the symbol pattern, see there for a explaination';
  131. begin = '(?:^|\s )(def)\b\s ((?>[a-zA-Z_]\w*(?>\.|::))?(?>[a-zA-Z_]\w*(?>[?!]|=(?!>))?|===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[- ]@?|\[\]=?))\s*\(';
  132. end = '\)';
  133. captures =
  134. { 1 = { name = 'keyword.control.def.ruby'; };
  135. 2 = { name = 'entity.name.function.ruby'; };
  136. };
  137. patterns = ( { include = '$base'; } );
  138. contentName = 'variable.parameter';
  139. },
  140. { name = 'declaration.function.method.without-arguments.ruby';
  141. comment = ' the optional name is just to catch the def also without a method-name';
  142. match = '(?:^|\s )(def)\b(\s ((?>[a-zA-Z_]\w*(?>\.|::))?(?>[a-zA-Z_]\w*(?>[?!]|=(?!>))?|===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[- ]@?|\[\]=?)))?';
  143. captures =
  144. { 1 = { name = 'keyword.control.def.ruby'; };
  145. 3 = { name = 'entity.name.function.ruby'; };
  146. };
  147. },
  148. { name = 'constant.numeric.ruby';
  149. match = '\b(0[xX]\h(?>_?\h)*|\d(?>_?\d)*(\.(?>_?\d)*)?([eE][- ]?(?>_?\d)*)?|0[bB][01] )\b';
  150. },
  151. { name = 'constant.other.symbol.single-quoted.ruby';
  152. begin = ":'";
  153. end = "'";
  154. swallow = '\\[''\\]';
  155. },
  156. { name = 'constant.other.symbol.double-quoted.ruby';
  157. begin = ':"';
  158. end = '"';
  159. swallow = '\\.';
  160. patterns = (
  161. { include = '#interpolated_ruby'; },
  162. { include = '#escaped_char'; },
  163. );
  164. },
  165. { name = 'string.quoted.single.ruby';
  166. comment = 'single quoted string (does not allow interpolation)';
  167. begin = "'";
  168. end = "'";
  169. swallow = '\\.';
  170. patterns = (
  171. { name = 'constant.character.escaped.ruby';
  172. match = '\\''|\\\\';
  173. }
  174. );
  175. },
  176. { name = 'string.quoted.double.ruby';
  177. comment = 'double quoted string (allows for interpolation)';
  178. begin = '"';
  179. end = '"';
  180. swallow = '\\.';
  181. patterns = (
  182. { include = '#interpolated_ruby'; },
  183. { include = '#escaped_char'; },
  184. );
  185. },
  186. { name = 'string.interpolated.ruby';
  187. comment = 'execute string (allows for interpolation)';
  188. begin = '`';
  189. end = '`';
  190. swallow = '\\.';
  191. patterns = (
  192. { include = '#interpolated_ruby'; },
  193. { include = '#escaped_char'; },
  194. );
  195. },
  196. { name = 'string.interpolated.ruby';
  197. comment = 'execute string (allow for interpolation)';
  198. begin = '%x\{';
  199. end = '\}';
  200. swallow = '\\.';
  201. patterns = (
  202. { include = '#interpolated_ruby'; },
  203. { include = '#escaped_char'; },
  204. { include = '#nest_curly_i'; },
  205. );
  206. },
  207. { name = 'string.interpolated.ruby';
  208. comment = 'execute string (allow for interpolation)';
  209. begin = '%x\[';
  210. end = '\]';
  211. swallow = '\\.';
  212. patterns = (
  213. { include = '#interpolated_ruby'; },
  214. { include = '#escaped_char'; },
  215. { include = '#nest_brackets_i'; },
  216. );
  217. },
  218. { name = 'string.interpolated.ruby';
  219. comment = 'execute string (allow for interpolation)';
  220. begin = '%x\<';
  221. end = '\>';
  222. swallow = '\\.';
  223. patterns = (
  224. { include = '#interpolated_ruby'; },
  225. { include = '#escaped_char'; },
  226. { include = '#nest_ltgt_i'; },
  227. );
  228. },
  229. { name = 'string.interpolated.ruby';
  230. comment = 'execute string (allow for interpolation)';
  231. begin = '%x\(';
  232. end = '\)';
  233. swallow = '\\.';
  234. patterns = (
  235. { include = '#interpolated_ruby'; },
  236. { include = '#escaped_char'; },
  237. { include = '#nest_parens_i'; },
  238. );
  239. },
  240. { name = 'string.interpolated.ruby';
  241. comment = 'execute string (allow for interpolation)';
  242. begin = '%x([^\w])';
  243. end = '\1';
  244. swallow = '\\.';
  245. patterns = (
  246. { include = '#interpolated_ruby'; },
  247. { include = '#escaped_char'; },
  248. );
  249. },
  250. { name = 'string.regexp.classic.ruby';
  251. comment = 'regular expressions (normal)
  252. we only start a regexp if the character before it (excluding whitespace)
  253. is what we think is before a regexp
  254. ';
  255. begin = '(?x)
  256. (?:
  257. ^ # beginning of line
  258. | (?<= # or look-behind on:
  259. [=>~(\[,|&]
  260. | (\s|;)when\s
  261. | (\s|;)or\s
  262. | (\s|;)and\s
  263. | (\s|;|\.)scan\s
  264. | (\s|;|\.)sub\s
  265. | (\s|l|\.)sub!\s
  266. | (\s|;|\.)gsub\s
  267. | (\s|;|\.)gsub!\s
  268. | (\s|;)if\s
  269. | (\s|;)elsif\s
  270. )
  271. | (?<= # or a look-behind with line anchor:
  272. ^when\s # duplication necessary due to limits of regex
  273. | ^scan\s
  274. | ^sub\s
  275. | ^gsub\s
  276. | ^gsub\s
  277. | ^gsub!\s
  278. | ^if\s
  279. | ^elsif\s
  280. )
  281. )
  282. \s*/(?![* {}?])
  283. ';
  284. end = '/[eimnosux]*';
  285. patterns = ( { include = '#regex_sub'; } );
  286. },
  287. { name = 'string.regexp.mod-r.ruby';
  288. comment = 'regular expressions (literal)';
  289. begin = '%r\{';
  290. end = '\}[eimnosux]*';
  291. patterns = (
  292. { include = '#regex_sub'; },
  293. { include = '#nest_curly_r'; },
  294. );
  295. },
  296. { name = 'string.regexp.mod-r.ruby';
  297. comment = 'regular expressions (literal)';
  298. begin = '%r\[';
  299. end = '\][eimnosux]*';
  300. patterns = (
  301. { include = '#regex_sub'; },
  302. { include = '#nest_brackets_r'; },
  303. );
  304. },
  305. { name = 'string.regexp.mod-r.ruby';
  306. comment = 'regular expressions (literal)';
  307. begin = '%r\(';
  308. end = '\)[eimnosux]*';
  309. patterns = (
  310. { include = '#regex_sub'; },
  311. { include = '#nest_parens_r'; },
  312. );
  313. },
  314. { name = 'string.regexp.mod-r.ruby';
  315. comment = 'regular expressions (literal)';
  316. begin = '%r\<';
  317. end = '\>[eimnosux]*';
  318. patterns = (
  319. { include = '#regex_sub'; },
  320. { include = '#nest_ltgt_r'; },
  321. );
  322. },
  323. { name = 'string.regexp.mod-r.ruby';
  324. comment = 'regular expressions (literal)';
  325. begin = '%r([^\w])';
  326. end = '\1[eimnosux]*';
  327. patterns = ( { include = '#regex_sub'; } );
  328. },
  329. { name = 'string.quoted.literal.upper.ruby';
  330. comment = 'literal capable of interpolation ()';
  331. begin = '%[QWSR]?\(';
  332. end = '\)';
  333. swallow = '\\.';
  334. patterns = (
  335. { include = '#interpolated_ruby'; },
  336. { include = '#escaped_char'; },
  337. { include = '#nest_parens_i'; },
  338. );
  339. },
  340. { name = 'string.quoted.literal.upper.ruby';
  341. comment = 'literal capable of interpolation []';
  342. begin = '%[QWSR]?\[';
  343. end = '\]';
  344. swallow = '\\.';
  345. patterns = (
  346. { include = '#interpolated_ruby'; },
  347. { include = '#escaped_char'; },
  348. { include = '#nest_brackets_i'; },
  349. );
  350. },
  351. { name = 'string.quoted.literal.upper.ruby';
  352. comment = 'literal capable of interpolation <>';
  353. begin = '%[QWSR]?\<';
  354. end = '\>';
  355. swallow = '\\.';
  356. patterns = (
  357. { include = '#interpolated_ruby'; },
  358. { include = '#escaped_char'; },
  359. { include = '#nest_ltgt_i'; },
  360. );
  361. },
  362. { name = 'string.quoted.double.ruby.mod';
  363. comment = 'literal capable of interpolation -- {}';
  364. begin = '%[QWSR]?\{';
  365. end = '\}';
  366. swallow = '\\.';
  367. patterns = (
  368. { include = '#interpolated_ruby'; },
  369. { include = '#escaped_char'; },
  370. { include = '#nest_curly_i'; },
  371. );
  372. },
  373. { name = 'string.quoted.literal.upper.ruby';
  374. comment = 'literal capable of interpolation -- wildcard';
  375. begin = '%[QWSR]([^\w])';
  376. end = '\1';
  377. swallow = '\\.';
  378. patterns = (
  379. { include = '#interpolated_ruby'; },
  380. { include = '#escaped_char'; },
  381. );
  382. },
  383. { name = 'string.quoted.literal.upper.ruby';
  384. comment = 'literal capable of interpolation -- wildcard';
  385. begin = '%([^\w\s])';
  386. end = '\1';
  387. swallow = '\\.';
  388. patterns = (
  389. { include = '#interpolated_ruby'; },
  390. { include = '#escaped_char'; },
  391. );
  392. },
  393. { name = 'string.quoted.literal.lower.ruby';
  394. comment = 'literal incapable of interpolation -- ()';
  395. begin = '%[qws]\(';
  396. end = '\)';
  397. swallow = '\\.';
  398. patterns = (
  399. { name = 'constant.character.escaped.ruby';
  400. match = '\\\)|\\\\';
  401. },
  402. { include = '#nest_parens'; },
  403. );
  404. },
  405. { name = 'string.quoted.literal.lower.ruby';
  406. comment = 'literal incapable of interpolation -- <>';
  407. begin = '%[qws]\<';
  408. end = '\>';
  409. swallow = '\\.';
  410. patterns = (
  411. { name = 'constant.character.escaped.ruby';
  412. match = '\\\>|\\\\';
  413. },
  414. { include = '#nest_ltgt'; },
  415. );
  416. },
  417. { name = 'string.quoted.literal.lower.ruby';
  418. comment = 'literal incapable of interpolation -- []';
  419. begin = '%[qws]\[';
  420. end = '\]';
  421. swallow = '\\.';
  422. patterns = (
  423. { name = 'constant.character.escaped.ruby';
  424. match = '\\\]|\\\\';
  425. },
  426. { include = '#nest_brackets'; },
  427. );
  428. },
  429. { name = 'string.quoted.single.ruby.mod';
  430. comment = 'literal incapable of interpolation -- {}';
  431. begin = '%[qws]\{';
  432. end = '\}';
  433. swallow = '\\.';
  434. patterns = (
  435. { name = 'constant.character.escaped.ruby';
  436. match = '\\\}|\\\\';
  437. },
  438. { include = '#nest_curly'; },
  439. );
  440. },
  441. { name = 'string.quoted.literal.lower.ruby';
  442. comment = 'literal incapable of interpolation -- wildcard';
  443. begin = '%[qws]([^\w])';
  444. end = '\1';
  445. swallow = '\\.';
  446. },
  447. { name = 'constant.other.symbol.ruby';
  448. comment = 'symbols';
  449. match = '(?<!:):(?>[a-zA-Z_]\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\|]|\*\*?|=?~|[- ]@?|\[\]=?|@@?[a-zA-Z_]\w*)';
  450. },
  451. { name = 'comment.documentation.ruby';
  452. comment = 'multiline comments';
  453. begin = '^=begin';
  454. end = '^=end';
  455. swallow = '\\.';
  456. },
  457. { name = 'comment.line.number-sign.ruby';
  458. match = '#.*$\n?';
  459. },
  460. { name = 'constant.numeric.ruby';
  461. comment = '
  462. matches questionmark-letters.
  463.  
  464. examples (1st alternation = hex):
  465. ?\x1 ?\x61
  466.  
  467. examples (2nd alternation = octal):
  468. ?\0 ?\07 ?\017
  469.  
  470. examples (3rd alternation = escaped):
  471. ?\n ?\b
  472.  
  473. examples (4th alternation = meta-ctrl):
  474. ?\C-a ?\M-a ?\C-\M-\C-\M-a
  475.  
  476. examples (4th alternation = normal):
  477. ?a ?A ?0
  478. ?* ?" ?(
  479. ?. ?#
  480.  
  481.  
  482. the negative lookbehind prevents against matching
  483. p(42.tainted?)
  484. ';
  485. match = '(?<!\w)\?(\\(x\h{1,2}(?!\h)\b|0[0-7]{0,2}(?![0-7])\b|[^x0MC])|(\\[MC]-) \w|[^\s\\])';
  486. },
  487. { comment = '__END__ marker';
  488. begin = '^__END__\n';
  489. end = '(?!impossible)impossible';
  490. captures = { 0 = { name = 'string.unquoted.program-block.ruby'; }; };
  491. contentName = 'text.plain';
  492. },
  493. { name = 'string.unquoted.heredoc.ruby';
  494. begin = '(?>\=\s*<<(\w ))(?!\s #\s*([Cc]|sh|[Jj]ava))';
  495. end = '^\1$';
  496. patterns = (
  497. { include = '#heredoc'; },
  498. { include = '#interpolated_ruby'; },
  499. { include = '#escaped_char'; },
  500. );
  501. },
  502. { name = 'string.unquoted.embedded.html.ruby';
  503. comment = 'heredoc with embedded HTML and indented terminator';
  504. begin = '(?><<-HTML\b)';
  505. end = '\s*HTML$';
  506. patterns = (
  507. { include = '#heredoc'; },
  508. { include = 'text.html.basic'; },
  509. { include = '#interpolated_ruby'; },
  510. { include = '#escaped_char'; },
  511. );
  512. contentName = 'text.html.embedded.ruby';
  513. },
  514. { name = 'string.unquoted.heredoc.ruby';
  515. comment = 'heredoc with indented terminator';
  516. begin = '(?><<-(\w ))';
  517. end = '\s*\1$';
  518. patterns = (
  519. { include = '#heredoc'; },
  520. { include = '#interpolated_ruby'; },
  521. { include = '#escaped_char'; },
  522. );
  523. },
  524. { name = 'string.unquoted.embedded.c.ruby';
  525. begin = '(?>\=\s*<<(\w ))(?=\s #\s*[Cc](?!(\ \ |[Ss][Ss])))';
  526. end = '^\1$';
  527. patterns = (
  528. { include = '#heredoc'; },
  529. { include = 'source.c'; },
  530. { include = '#interpolated_ruby'; },
  531. { include = '#escaped_char'; },
  532. );
  533. },
  534. { name = 'string.unquoted.embedded.cplusplus.ruby';
  535. begin = '(?>\=\s*<<(\w ))(?=\s #\s*[Cc]\ \ )';
  536. end = '^\1$';
  537. patterns = (
  538. { include = '#heredoc'; },
  539. { include = 'source.c '; },
  540. { include = '#interpolated_ruby'; },
  541. { include = '#escaped_char'; },
  542. );
  543. },
  544. { name = 'string.unquoted.embedded.css.ruby';
  545. begin = '(?>\=\s*<<(\w ))(?=\s #\s*[Cc][Ss][Ss])';
  546. end = '^\1$';
  547. patterns = (
  548. { include = '#heredoc'; },
  549. { include = 'source.css'; },
  550. { include = '#interpolated_ruby'; },
  551. { include = '#escaped_char'; },
  552. );
  553. },
  554. { name = 'string.unquoted.embedded.js.ruby';
  555. begin = '(?>\=\s*<<(\w ))(?=\s #\s*[Jj]ava[Ss]cript)';
  556. end = '^\1$';
  557. patterns = (
  558. { include = '#heredoc'; },
  559. { include = 'source.js.prototype'; },
  560. { include = '#interpolated_ruby'; },
  561. { include = '#escaped_char'; },
  562. );
  563. },
  564. { name = 'string.unquoted.embedded.shell.ruby';
  565. begin = '(?>\s*<<(\w ))(?=\s #\s*sh)';
  566. end = '^\1$';
  567. patterns = (
  568. { include = '#heredoc'; },
  569. { include = 'source.shell'; },
  570. { include = '#interpolated_ruby'; },
  571. { include = '#escaped_char'; },
  572. );
  573. },
  574. { name = 'support.function.core.ruby';
  575. comment = '
  576. adding all the core methods here to provide a visual aid for spelling errors,
  577. as long as the current theme highlights [support.function] scopes.
  578.  
  579. ie: if you miss type first as fisrt, then the word will not highlight.';
  580. match = '\b(abort_on_exception=|absolute\?|acos!|acosh!|add!|add\?|alive\?|all\?|any\?|asin!|asinh!|async=|atan!|atan2!|atanh!|attributes=|autoload\?|avail_out=|beginning_of_line\?|between\?|block_given\?|blockdev\?|bol\?|capitalize!|casefold\?|changed\?|chardev\?|charset=|chomp!|chop!|close!|closed\?|closed_read\?|closed_write\?|codepage=|collect!|comment=|compact!|const_defined\?|coredump\?|cos!|cosh!|critical=|data=|dataType=|datetime_format=|debug\?|default=|delete!|delete\?|directory\?|dn=|downcase!|dst\?|egid=|eid=|empty\?|enclosed\?|end\?|ended\?|eof\?|eos\?|eql\?|eqn\?|equal\?|error\?|event\?|exclude_end\?|executable\?|executable_real\?|exist\?|exists\?|exit!|exited\?|euid=|exp!|extensions=|fatal\?|file\?|filter=|finished\?|finite\?|flatten!|fnmatch\?|fragment=|frozen\?|fu_have_symlink\?|fu_world_writable\?|gid=|gmt\?|gregorian_leap\?|groups=|grpowned\?|gsub!|has_key\?|has_value\?|headers=|hierarchical\?|host=|identical\?|include\?|infinite\?|info\?|input\?|instance_of\?|integer\?|is_a\?|iterator\?|julian_leap\?|key\?|kind_of\?|leap\?|level=|lineno=|locked\?|log!|log10!|log=|lstrip!|map!|match\?|matched\?|max=|maxgroups=|member\?|merge!|method_defined\?|mountpoint\?|multipart\?|mtime=|multipart\?|nan\?|new!|next!|next\?|nil\?|nodeTypedValue=|nodeValue=|nonzero\?|normalize!|ns\?|ondataavailable=|onreadystatechange=|ontransformnode=|opaque=|optional\?|orig_name=|os\?|output\?|owned\?|params=|password=|path=|pipe\?|pointer=|port=|pos=|power!|preserveWhiteSpace=|priority=|private_method_defined\?|proper_subset\?|proper_superset\?|protected_method_defined\?|public_method_defined\?|query=|re_exchangeable\?|readable\?|readable_real\?|registry=|regular\?|reject!|relative\?|resolveExternals=|respond_to\?|rest\?|retval\?|reverse!|root\?|rstrip!|run\?|run=|scheme=|scope=|secure=|setgid\?|setuid\?|sid_available\?|signaled\?|sin!|singular\?|sinh!|size\?|slice!|socket\?|sort!|sqrt!|square\?|squeeze!|sticky\?|stop\?|stopped\?|stream_end\?|string=|strip!|sub!|subset\?|succ!|success\?|superset\?|swapcase!|symlink\?|sync=|sync_point\?|tainted\?|tan!|tanh!|text=|to=|tr!|tr_s!|tty\?|typecode=|uid=|uniq!|upcase!|uptodate\?|url=|user=|userinfo=|utc\?|valid_civil\?|valid_commercial\?|valid_jd\?|valid_ordinal\?|valid_time\?|validateOnParse=|value=|value\?|visible\?|warn\?|writable\?|writable_real\?|zero\?)|\b(__getobj__|__id__|__init__|__send__|__setobj__|_dump|_getproperty|_id2ref|_invoke|_load|_setproperty|abbrev|abort_on_exception|abort|abs2|absoluteChildNumber|absolute|abs|acosh|acos|add_builtin_type|add_domain_type|add_finalizer|add_observer|add_private_type|add_ruby_type|add|adler32|adler|ajd_to_amjd|ajd_to_jd|ajd|a|all_symbols|all_waits|allocate|amjd_to_ajd|amjd|ancestorChildNumber|ancestors|angle|appendChild|appendData|append_features|args|arg|arity|asctime|asinh|asin|assoc|async|at_exit|atan2|atanh|atan|atime|attributes|attr|at|autoload|avail_in|avail_out|b64encode|backtrace|baseName|basename|base|benchmark|binding|bind|binmode|blksize|blockquote|blocks|bmbm|bm|broadcast|build2|build|call_finalizer|callcc|caller|call|capitalize|caption|captures|casecmp|catch|cd|ceil|center|change_privilege|changed|charset_map|charset|chdir|check_until|checkbox_group|checkbox|check|childNodes|childNumber|children|chmod_R|chmod|chomp|chop|chown_R|chown|chroot|chr|civil_to_jd|civil|class_eval|class_name|class_variable_get|class_variable_set|class_variables|classify|class|cleanpath|clear|cloneNode|clone|close_read|close_write|close|cmp|codepage|coerce|collect2|collect|column_size|column_vector|column_vectors|columns|column|comment|commercial_to_jd|commercial|commit|compact|compare_by_row_vectors|compare_by|compare_file|compare_stream|compile|component_ary|component|concat|conj|conjugate|connect|const_get|const_load|const_missing|const_set|constants|conv|copy_entry|copy_file|copy_stream|copy|cosh|cos|count_observers|count|covector|cp_r|cp|crc32|crc_table|crc|createAttribute|createCDATASection|createComment|createDocumentFragment|createElement|createEntityReference|createNode|createProcessingInstruction|createTextNode|create_docfile|create_win32ole_makefile|critical|crypt|ctime|current|cwday|cweek|cwyear|dataType|data_type|data|datetime_format|day_fraction|day_fraction_to_time|day|debug|decode64|decode_b|decode|def_delegator|def_delegators|def_instance_delegator|def_instance_delegators|def_singleton_delegator|def_singleton_delegators|default_handler|default_port|default_proc|default|define_class|define_finalizer|define_include|define_initialize|define_instance_variables|define_method|define_method_missing|define_module|definition|deflate|deleteData|delete_at|delete_if|delete_observer|delete_observers|delete|denominator|depth|deq|detach|detect|detect_implicit|determinant|det|dev_major|dev_minor|dev|diagonal|difference|dir_foreach|dirname|disable|dispid|display|divide|divmod|div|dn|doctype|documentElement|downcase|downto|dump_stream|dump|dup|each2|each_byte|each_cons|each_document|each_entry|each_filename|each_index|each_key|each_line|each_node|each_object|each_pair|each_slice|each_value|each_with_index|each|eid|elements|emitter|enable|enclose|encode64|encode|end|england|enq|entities|entries|enum_cons|enum_for|enum_slice|enum_with_index|eof|erfc|erf|errno|errorCode|error|escapeElement|escapeHTML|escape|euid|eval|event_interface|exception|exclusive|exclusive_unlock|exec|exit_value|exitstatus|exit|expand_path|exp|extend_object|extended|extend|extensions|extname|extract|failed|fail|fatal|fcntl|fetch|file_field|fileno|filepos|fill|filter|finalizers|find_all|find|finish|first|firstChild|flatten_merge|flatten|flock|floor|flush_next_in|flush_next_out|flush|fnmatch|for_fd|foreachline|foreach|fork|format|formatDate|formatIndex|formatNumber|formatTime|form|freeze|frexp|fsync|ftype|garbage_collect|gcdlcm|gcd|generate_args|generate_argtype|generate_argtypes|generate_class|generate_constants|generate_func_methods|generate_method_args_help|generate_method_body|generate_method_help|generate_methods|generate_method|generate_properties_with_args|generate_propget_methods|generate_propput_methods|generate_propputref_methods|generate|generic_parser|getAllResponseHeaders|getAttribute|getAttributeNode|getElementsByTagName|getNamedItem|getQualifiedItem|getResponseHeader|get_byte|getbyte|getch|getc|getegid|geteuid|getgid|getgm|getlocal|getpgid|getpgrp|getpriority|gets|getuid|getutc|getwd|gid|global_variables|glob|gmt_offset|gmtime|gmtoff|gm|grant_privilege|gregorian|grep|groups|group|gsub|guess1|guess2|guess_old|guess|guid|handler1|handler2|handler3|hasChildNodes|hasFeature|hash|header|helpcontext|helpfile|helpstring|hex|hidden|hour|html_escape|html|httpdate|hypot|h|iconv|id2name|identity|id|imag|image_button|image|img|implementation|im|included_modules|included|include|indexes|index|indices|induced_from|inflate|info|inherited|init_elements|initgroups|initialize_copy|inject|inner_product|ino|insertBefore|insertData|insert|inspect|install|instance_eval|instance_method|instance_methods|instance_variable_get|instance_variable_set|instance_variables|intern|intersection|inverse|inverse_from|invert|invkind|invoke|invoke_kind|inv|ioctl|isatty|isdst|iseuc|iso8601|issetugid|issjis|isutf8|italy|item|jd_to_ajd|jd_to_civil|jd_to_commercial|jd_to_ld|jd_to_mjd|jd_to_ordinal|jd_to_wday|jd|join_nowait|join|julian|kcode|kconv|keys|kill|lambda|lastChild|last_match|last|lchmod|lchown|lcm|ld_to_jd|ldexp|ld|length|level|lineno|linepos|(?:\.)line|link|listup|list|ljust|ln_s|ln_sf|ln|loadXML|load_documents|load_file|load_stream|load|local_variables|localtime|local|lock|log10|log|loop|lstat|lstrip|main|major_version|make_link|make_symlink|makedirs|map2|map|marshal_dump|marshal_load|matched|matched_size|matchedsize|match|maxgroups|max|mday|measure|members|memberwise|merge|message_loop|message|method_added|method_missing|method_removed|method_undefined|methods|method|minor|minor_version|min|mjd_to_jd|mjd|mkdir_p|mkdir|mkpath|mktime|mode|module_eval|module_function|modulo|month|mon|move|mtime|multipart_form|must_C_version|mv|namespaceURI|name|navigate|nesting|new2|new_start|new|nextNode|nextSibling|next_wait|next|nitems|nkf|nlink|nodeFromID|nodeName|nodeType|nodeTypeString|nodeTypedValue|nodeValue|normalize|notationName|notations|notify_observers|now|num_waiting|numerator|object_id|object_maker|oct|offset_vtbl|offset|ole_classes|ole_free|ole_func_methods|ole_get_methods|ole_method|ole_method_help|ole_methods|ole_obj_help|ole_put_methods|ole_reference_count|ole_show_help|ole_type_detail|ole_type|oletypelib_name|on_event_with_outargs|on_event|ondataavailable|onreadystatechange|opendir|open|options|ordinal_to_jd|ordinal|orig_name|os_code|out|ownerDocument|pack|params|parentNode|parent|parseError|parse_documents|parse_file|parsed|parser|parse|partition|password|password_field|pass|path|peek|peep|pid|pipe|pointer|polar|popen|popup_menu|pop|post_match|pos|ppid|pre_match|prec_f|prec_i|prec|prefix|preserveWhiteSpace|pretty|previousSibling|printf|print|priority|private_class_method|private_instance_methods|private_methods|private|proc|progids|progid|protected_instance_methods|protected_methods|protected|prune|publicId|public_class_method|public_instance_methods|public_methods|public|push|putc|puts|pwd|p|quick_emit|quote|quo|radio_button|radio_group|raise|rand|rank|rassoc|raw_cookie|raw_cookie2|rdev_major|rdev_minor|rdev|rdiv|re_exchange|read_type_class|readchar|readlines|readline|readlink|readpartial|readyState|read|realpath|realtime|real|reason|reduce|regexp|rehash|reject|relative_path_from|remainder|removeAttribute|removeAttributeNode|removeChild|removeNamedItem|removeQualifiedItem|remove_class_variable|remove_const|remove_dir|remove_entry_secure|remove_entry|remove_file|remove_finalizer|remove_instance_variable|remove_method|remove|rename|reopen|replaceChild|replaceData|replace|request_uri|require|reset|resolveExternals|resolver|responseBody|responseStream|responseText|responseXML|rest_size|restore|restsize|rest|result|return_type_detail|return_type|return_vtype|reverse_each|reverse|rewind|rfc1123_date|rfc2822|rfc822|rid|rindex|rjust|rm_f|rm_rf|rm_r|rmdir|rmtree|rm|roots|root|round|route_from|route_to|row_size|row_vector|row_vectors|rows|row|rpower|rstrip|run|r|safe_level|safe_unlink|save|scalar|scan_full|scan_until|scan|scope|scrolling_list|search_full|sec|seek|selectNodes|selectSingleNode|select|send|setAttribute|setAttributeNode|setNamedItem|setRequestHeader|set_attributes|set_backtrace|set_dictionary|set_dn|set_eoutvar|set_extensions|set_filter|set_fragment|set_headers|set_host|set_log|set_opaque|set_password|set_path|set_port|set_query|set_registry|set_scheme|set_scope|set_to|set_trace_func|set_typecode|set_user|set_userinfo|setegid|seteuid|setgid|setpgid|setpgrp|setpriority|setproperty|setregid|setresgid|setresuid|setreuid|setrgid|setruid|setsid|setuid|setup|shellwords|shift|signal|sin|singleton_method_added|singleton_method_removed|singleton_method_undefined|singleton_methods|sinh|size_opt_params|size_params|size|skip_until|skip|sleep|slice|sort_by|sort|source|specified|split|splitText|sprintf|sqrt|squeeze|srand|srcText|src_type|start|status|statusText|stat|step|stop_msg_loop|stopsig|stop|store|strftime|string|strip|strptime|sub|submit|substringData|subtract|succ|success|sum|superclass|swapcase|switch|symlink|synchronize|sync|syscall|sysopen|sysread|sysseek|systemId|system|syswrite|tagName|tagurize|taint|tanh|tan|target|teardown|tell|terminate|termsig|test__invoke|test_bracket_equal_with_arg|test_class_to_s|test_const_CP_ACP|test_const_CP_MACCP|test_const_CP_OEMCP|test_const_CP_SYMBOL|test_const_CP_THREAD_ACP|test_const_CP_UTF7|test_const_CP_UTF8|test_convert_bignum|test_dispid|test_each|test_event|test_event_interface|test_get_win32ole_object|test_helpcontext|test_helpfile|test_helpstring|test_input|test_invoke_kind|test_invoke|test_name|test_no_exist_property|test_offset_vtbl|test_ole_func_methods|test_ole_get_methods|test_ole_invoke_with_named_arg|test_ole_invoke_with_named_arg_last|test_ole_method_help|test_ole_methods|test_ole_put_methods|test_ole_type|test_ole_type_detail|test_on_event|test_on_event2|test_on_event3|test_on_event4|test_openSchema|test_optional|test_output|test_return_type|test_return_type_detail|test_return_vtype|test_s_codepage|test_s_codepage_changed|test_s_codepage_set|test_s_connect|test_s_const_load|test_s_new|test_s_new_DCOM|test_s_new_from_clsid|test_s_ole_classes|test_s_progids|test_s_typelibs|test_setproperty|test_setproperty_bracket|test_setproperty_with_equal|test_src_type|test_to_s|test_typekind|test_value|test_variables|test_variant|test_visible|test|text_field|textarea|text|throw|time_to_day_fraction|timeout|times|tmpdir|to_ary|to_a|to_enum|to_f|to_hash|to_int|to_io|to_i|to_mailtext|to_proc|to_rfc822text|to_r|to_set|to_str|to_sym|to_s|today|toeuc|tojis|tosjis|total_in|total_out|touch|toutf16|toutf8|tr_s|trace_var|trace|transaction|transfer|transformNode|transformNodeToObject|transpose|trap|truncate|try_implicit|try_lock|tr|tv_sec|tv_usec|typekind|typelibs|type|t|uid|umask|unbind|undef_method|undefine_finalizer|unescapeElement|unescapeHTML|unescape|ungetc|union|uniqueID|uniq|unknown|unlink|unlock|unpack|unscan|unshift|untaint|untrace_var|unused|upcase|update|upto|url_encode|url|use_registry|usec|userinfo|user|utc_offset|utc|utime|u|validateOnParse|values_at|values|value|variable_kind|variables|varkind|version|wait2|waitall|waitpid|waitpid2|wait|wakeup|warn|wday|wrap|write|xmlschema|xml|yday|year|yield|zero|zip|zlib_version|zone_offset|zone)\b';
  581. },
  582. { match = '(?<=\{\t|do\t|\{ |do |\{|do)(\|)([a-zA-Z0-9_\s,] )(\|)';
  583. captures =
  584. { 1 = { name = 'meta.brace.pipe.ruby'; };
  585. 2 = { name = 'variable.other.block.ruby'; };
  586. 3 = { name = 'meta.brace.pipe.ruby'; };
  587. };
  588. },
  589. { name = 'keyword.operator.setter.arrow';
  590. match = '=>';
  591. },
  592. { name = 'keyword.operator.getter';
  593. match = '===|==|=~|!~|!=|>(?!>)|<(?!<)|>=|~|\|\|(?!=)|\|(?![=|\|])|<=>|<=|>=';
  594. },
  595. { name = 'keyword.operator.setter';
  596. match = '%|&|\*\*|\*|\ |-|/|<<|=|>>|>|\^|\|\|=';
  597. },
  598. { include = '#round-brackets'; },
  599. { name = 'meta.delimiter.statement.ruby';
  600. match = '\;';
  601. },
  602. { name = 'meta.delimiter.object.ruby';
  603. match = ',';
  604. },
  605. { name = 'meta.delimiter.method.ruby';
  606. match = '\.';
  607. },
  608. { name = 'meta.brace.curly.ruby';
  609. match = '\{|\}';
  610. },
  611. { name = 'meta.brace.square.ruby';
  612. match = '\[|\]';
  613. },
  614. { name = 'meta.brace.round.ruby';
  615. match = '\(|\)';
  616. },
  617. );
  618. repository =
  619. { escaped_char =
  620. { name = 'constant.character.escaped.ruby';
  621. match = '\\(?:0\d{1,2}|x[\da-fA-F]{1,2}|.)';
  622. };
  623. heredoc =
  624. { begin = '^<<-?\w ';
  625. end = '$';
  626. patterns = ( { include = '$base'; } );
  627. };
  628. interpolated_ruby = { patterns = (
  629. { name = 'source.ruby.embedded.source.brace';
  630. begin = '#\{';
  631. end = '\}';
  632. patterns = ( { include = '#nest_curly_and_self'; } );
  633. contentName = 'source.ruby.embedded.source';
  634. },
  635. { name = 'variable.other.readwrite.instance.ruby';
  636. match = '#@[a-zA-Z_]\w*';
  637. },
  638. { name = 'variable.other.readwrite.class.ruby';
  639. match = '#@@[a-zA-Z_]\w*';
  640. },
  641. { name = 'variable.other.readwrite.global.ruby';
  642. match = '#\$[a-zA-Z_]\w*';
  643. },
  644. );
  645. };
  646. nest_brackets =
  647. { begin = '\[';
  648. end = '\]';
  649. patterns = ( { include = '#nest_brackets'; } );
  650. };
  651. nest_brackets_i =
  652. { begin = '\[';
  653. end = '\]';
  654. patterns = (
  655. { include = '#interpolated_ruby'; },
  656. { include = '#escaped_char'; },
  657. { include = '#nest_brackets_i'; },
  658. );
  659. };
  660. nest_brackets_r =
  661. { begin = '\[';
  662. end = '\]';
  663. patterns = (
  664. { include = '#regex_sub'; },
  665. { include = '#nest_brackets_r'; },
  666. );
  667. };
  668. nest_curly =
  669. { begin = '\{';
  670. end = '\}';
  671. patterns = ( { include = '#nest_curly'; } );
  672. };
  673. nest_curly_and_self = { patterns = (
  674. { begin = '\{';
  675. end = '\}';
  676. patterns = ( { include = '#nest_curly_and_self'; } );
  677. },
  678. { include = '$self'; },
  679. );
  680. };
  681. nest_curly_i =
  682. { begin = '\{';
  683. end = '\}';
  684. patterns = (
  685. { include = '#interpolated_ruby'; },
  686. { include = '#escaped_char'; },
  687. { include = '#nest_curly_i'; },
  688. );
  689. };
  690. nest_curly_r =
  691. { begin = '\{';
  692. end = '\}';
  693. patterns = (
  694. { include = '#regex_sub'; },
  695. { include = '#nest_curly_r'; },
  696. );
  697. };
  698. nest_ltgt =
  699. { begin = '\<';
  700. end = '\>';
  701. patterns = ( { include = '#nest_ltgt'; } );
  702. };
  703. nest_ltgt_i =
  704. { begin = '\<';
  705. end = '\>';
  706. patterns = (
  707. { include = '#interpolated_ruby'; },
  708. { include = '#escaped_char'; },
  709. { include = '#nest_ltgt_i'; },
  710. );
  711. };
  712. nest_ltgt_r =
  713. { begin = '\<';
  714. end = '\>';
  715. patterns = (
  716. { include = '#regex_sub'; },
  717. { include = '#nest_ltgt_r'; },
  718. );
  719. };
  720. nest_parens =
  721. { begin = '\(';
  722. end = '\)';
  723. patterns = ( { include = '#nest_parens'; } );
  724. };
  725. nest_parens_i =
  726. { begin = '\(';
  727. end = '\)';
  728. patterns = (
  729. { include = '#interpolated_ruby'; },
  730. { include = '#escaped_char'; },
  731. { include = '#nest_parens_i'; },
  732. );
  733. };
  734. nest_parens_r =
  735. { begin = '\(';
  736. end = '\)';
  737. patterns = (
  738. { include = '#regex_sub'; },
  739. { include = '#nest_parens_r'; },
  740. );
  741. };
  742. regex_sub = { patterns = (
  743. { include = '#interpolated_ruby'; },
  744. { include = '#escaped_char'; },
  745. { name = 'string.regexp.arbitrary-repitition.ruby';
  746. match = '\{\d (,\d )?\}';
  747. },
  748. { name = 'string.regexp.character-class.ruby';
  749. begin = '\[(?:\^?\])?';
  750. end = '\]';
  751. patterns = ( { include = '#escaped_char'; } );
  752. },
  753. { name = 'string.regexp.group.ruby';
  754. begin = '\(';
  755. end = '\)';
  756. patterns = ( { include = '#regex_sub'; } );
  757. },
  758. { name = 'comment.line.number-sign.ruby';
  759. comment = 'Only allow word characters and punctuation to avoid false positives, since the availability of comments depend on regexp flags.';
  760. match = '(?<=^|\s)#\s[a-zA-Z0-9,. ]*$';
  761. },
  762. );
  763. };
  764. round-brackets = { patterns = (
  765. { begin = '\{';
  766. end = '\}|(?=%>)';
  767. captures = { 0 = { name = 'meta.brace.curly.ruby.experimental'; }; };
  768. patterns = ( { include = 'source.ruby.experimental'; } );
  769. contentName = 'meta.group.braces.curly.ruby.experimental';
  770. }
  771. );
  772. };
  773. };
  774. }
Add Comment
Please, Sign In to add comment