# -*- coding: utf-8 -*- # # frozen_string_literal: true module Rouge module Lexers class TOML < RegexLexer title "TOML" desc 'the TOML configuration format (https://github.com/toml-lang/toml)' tag 'toml' filenames '*.toml', 'Pipfile', 'poetry.lock' mimetypes 'text/x-toml' # bare keys and quoted keys identifier = %r/(?:\S+|"[^"]+"|'[^']+')/ state :basic do rule %r/\s+/, Text rule %r/#.*?$/, Comment rule %r/(true|false)/, Keyword::Constant rule %r/(#{identifier})(\s*)(=)(\s*)(\{)/ do groups Name::Property, Text, Operator, Text, Punctuation push :inline end end state :root do mixin :basic rule %r/(?