ruby.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. - method definitions (including singleton methods and aliases, with associated comments)
  3. - class definitions (including singleton classes, with associated comments)
  4. - module definitions
  5. */
  6. export default `
  7. (
  8. (comment)* @doc
  9. .
  10. [
  11. (method
  12. name: (_) @name.definition.method) @definition.method
  13. (singleton_method
  14. name: (_) @name.definition.method) @definition.method
  15. ]
  16. (#strip! @doc "^#\\s*")
  17. (#select-adjacent! @doc @definition.method)
  18. )
  19. (alias
  20. name: (_) @name.definition.method) @definition.method
  21. (
  22. (comment)* @doc
  23. .
  24. [
  25. (class
  26. name: [
  27. (constant) @name.definition.class
  28. (scope_resolution
  29. name: (_) @name.definition.class)
  30. ]) @definition.class
  31. (singleton_class
  32. value: [
  33. (constant) @name.definition.class
  34. (scope_resolution
  35. name: (_) @name.definition.class)
  36. ]) @definition.class
  37. ]
  38. (#strip! @doc "^#\\s*")
  39. (#select-adjacent! @doc @definition.class)
  40. )
  41. (
  42. (module
  43. name: [
  44. (constant) @name.definition.module
  45. (scope_resolution
  46. name: (_) @name.definition.module)
  47. ]) @definition.module
  48. )
  49. `