Sha256: a6fb6c12a64082129de3be05a82c249ee498fb2f2af8318acbf9111d2d3e105f

Contents?: true

Size: 695 Bytes

Versions: 2

Compression:

Stored size: 695 Bytes

Contents

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

module Rouge
  module Lexers
    load_lexer 'javascript.rb'
    load_lexer 'typescript/common.rb'

    class Typescript < Javascript
      include TypescriptCommon

      title "TypeScript"
      desc "TypeScript, a superset of JavaScript"

      tag 'typescript'
      aliases 'ts'

      filenames '*.ts', '*.d.ts'

      mimetypes 'text/typescript'

      prepend :root do
        rule %r/[?][.]/, Punctuation
      end

      prepend :statement do
        rule %r/(#{Javascript.id_regex})(\??)(\s*)(:)/ do
          groups Name::Label, Punctuation, Text, Punctuation
          push :expr_start
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rouge-3.19.0 lib/rouge/lexers/typescript.rb
rouge-3.18.0 lib/rouge/lexers/typescript.rb