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-3.26.0 lib/rouge/lexers/csvs.rb
rouge-3.25.0 lib/rouge/lexers/csvs.rb
rouge-3.24.0 lib/rouge/lexers/csvs.rb
rouge-3.23.0 lib/rouge/lexers/csvs.rb
rouge-3.22.0 lib/rouge/lexers/csvs.rb
rouge-3.21.0 lib/rouge/lexers/csvs.rb
rouge-3.20.0 lib/rouge/lexers/csvs.rb
rouge-3.19.0 lib/rouge/lexers/csvs.rb
rouge-3.18.0 lib/rouge/lexers/csvs.rb
rouge-3.17.0 lib/rouge/lexers/csvs.rb
rouge-3.16.0 lib/rouge/lexers/csvs.rb
rouge-3.15.0 lib/rouge/lexers/csvs.rb
rouge-3.14.0 lib/rouge/lexers/csvs.rb
rouge-3.13.0 lib/rouge/lexers/csvs.rb
rouge-3.12.0 lib/rouge/lexers/csvs.rb
rouge-3.11.1 lib/rouge/lexers/csvs.rb
rouge-3.11.0 lib/rouge/lexers/csvs.rb