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
|