Sha256: 8e2a7cf8c64c7b5432f653ade5576e1d239263ae3e1369691b88c05e246821d9
Contents?: true
Size: 1.44 KB
Versions: 4
Compression:
Stored size: 1.44 KB
Contents
# -*- coding: utf-8 -*- # # frozen_string_literal: true module Rouge module Lexers class TOML < RegexLexer title "TOML" desc 'the TOML configuration format (https://github.com/mojombo/toml)' tag 'toml' filenames '*.toml' mimetypes 'text/x-toml' identifier = /[\w.\S]+/ state :basic do rule /\s+/, Text rule /#.*?$/, Comment rule /(true|false)/, Keyword::Constant rule /(?<!=)\s*\[[\w\d\S]+\]/, Name::Namespace rule /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z/, Literal::Date rule /(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?/, Num::Float rule /\d+[eE][+-]?[0-9]+j?/, Num::Float rule /\-?\d+/, Num::Integer end state :root do mixin :basic rule /(#{identifier})(\s*)(=)/ do groups Name::Property, Text, Punctuation push :value end end state :value do rule /\n/, Text, :pop! mixin :content end state :content do mixin :basic rule /"/, Str, :dq mixin :esc_str rule /\,/, Punctuation rule /\[/, Punctuation, :array end state :dq do rule /"/, Str, :pop! mixin :esc_str rule /[^\\"]+/, Str end state :esc_str do rule /\\[0t\tn\n "\\ r]/, Str::Escape end state :array do mixin :content rule /\]/, Punctuation, :pop! end end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
rouge-3.4.1 | lib/rouge/lexers/toml.rb |
rouge-3.4.0 | lib/rouge/lexers/toml.rb |
rouge-alda-3.3.0 | lib/rouge/lexers/toml.rb |
rouge-3.3.0 | lib/rouge/lexers/toml.rb |