Sha256: 97e8e488e19fff93067c0aee4f08e81fe3e89104cf899b3dc0185cc05aec36b0

Contents?: true

Size: 1.13 KB

Versions: 37

Compression:

Stored size: 1.13 KB

Contents

# -*- coding: utf-8 -*- #
# frozen_string_literal: true

module Rouge
  module Lexers
    class CSVS < RegexLexer
      tag 'csvs'
      title "csvs"
      desc 'The CSV Schema Language (digital-preservation.github.io)'
      filenames '*.csvs'

      state :root do
        rule %r/\s+/m, Text

        rule %r(//[\S\t ]*), Comment::Single
        rule %r(/\*[^*]*\*/)m, Comment::Multiline

        rule %r/(version)( )(\d+\.\d+)/ do
          groups Keyword, Text::Whitespace, Num::Float
        end

        rule %r/T?\d{2}:\d{2}:\d{2}(\.\d{5})?(Z|(?:[-+]\d{2}:\d{2}))?/, Literal::Date
        rule %r/\d{4}-\d{2}-\d{2}/, Literal::Date
        rule %r/\d{2}\/\d{2}\/\d{4}/, Literal::Date

        rule %r((\d+[.]?\d*|\d*[.]\d+)(e[+-]?[0-9]+)?)i, Num::Float
        rule %r/\d+/, Num::Integer

        rule %r/@\w+/, Keyword::Pseudo

        rule %r/[-.\w]+:/, Name::Variable
        rule %r/^"[^"]+"/, Name::Variable
        rule %r/\$([-.\w]+|("[^"]+"))\/?/, Name::Variable

        rule %r/[A-Z]+/i, Keyword

        rule %r/"[^"]*"/, Str::Double
        rule %r/'[^\r\n\f']'/, Str::Char

        rule %r/[,()*]/, Punctuation
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
rouge-4.5.1 lib/rouge/lexers/csvs.rb
rouge-4.5.0 lib/rouge/lexers/csvs.rb
rouge-4.4.0 lib/rouge/lexers/csvs.rb
rouge-4.3.0 lib/rouge/lexers/csvs.rb
rouge-4.2.1 lib/rouge/lexers/csvs.rb
rouge-4.2.0 lib/rouge/lexers/csvs.rb
rouge-4.1.3 lib/rouge/lexers/csvs.rb
rouge-4.1.2 lib/rouge/lexers/csvs.rb
rouge-4.1.1 lib/rouge/lexers/csvs.rb
mumukit-content-type-1.12.1 vendor/bundle/ruby/2.7.0/gems/rouge-3.30.0/lib/rouge/lexers/csvs.rb
mumukit-content-type-1.12.0 vendor/bundle/ruby/2.7.0/gems/rouge-3.30.0/lib/rouge/lexers/csvs.rb
rouge-4.1.0 lib/rouge/lexers/csvs.rb
rouge-4.0.1 lib/rouge/lexers/csvs.rb
rouge-4.0.0 lib/rouge/lexers/csvs.rb
rouge-3.30.0 lib/rouge/lexers/csvs.rb
rouge-3.29.0 lib/rouge/lexers/csvs.rb
rouge-3.28.0 lib/rouge/lexers/csvs.rb
rouge-3.27.0 lib/rouge/lexers/csvs.rb
rouge-3.26.1 lib/rouge/lexers/csvs.rb
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/rouge-3.26.0/lib/rouge/lexers/csvs.rb