File: codeowners.rb

package info (click to toggle)
ruby-rouge 4.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,844 kB
  • sloc: ruby: 38,489; sed: 2,071; perl: 152; makefile: 8
file content (30 lines) | stat: -rw-r--r-- 706 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*- #
# frozen_string_literal: true

module Rouge
  module Lexers
    class Codeowners < RegexLexer
      title 'CODEOWNERS'
      desc 'Code Owners syntax (https://docs.gitlab.com/ee/user/project/codeowners/reference.html)'
      tag 'codeowners'
      filenames 'CODEOWNERS'

      state :root do
        rule %r/[ \t\r\n]+/, Text::Whitespace
        rule %r/^\s*#.*$/, Comment::Single

        rule %r(
          (\^?\[(?!\d+\])[^\]]+\])
          (\[\d+\])?
        )x do
          groups Name::Namespace, Literal::Number
        end

        rule %r/\S*@\S+/, Name::Function

        rule %r/[\p{Word}\.\/\-\*]+/, Name
        rule %r/.*\\[\#\s]/, Name
      end
    end
  end
end