Parent

Class/Module Index [+]

Quicksearch

Rouge::Lexers::TCL

Public Class Methods

analyze_text(text) click to toggle source
# File lib/rouge/lexers/tcl.rb, line 9
def self.analyze_text(text)
  return 1 if text.shebang? 'tclsh'
  return 1 if text.shebang? 'wish'
  return 1 if text.shebang? 'jimsh'
end
gen_command_state(name='') click to toggle source
# File lib/rouge/lexers/tcl.rb, line 54
def self.gen_command_state(name='')
  state(:"command#{name}") do
    mixin :word

    rule /##{NOT_CHARS[END_LINE]}+/, Comment::Single

    rule /(?=#{CHARS[END_WORD]})/ do
      push :"params#{name}"
    end

    rule /#{NOT_CHARS[END_WORD]}+/ do |m|
      if KEYWORDS.include? m[0]
        token Keyword
      elsif BUILTINS.include? m[0]
        token Name::Builtin
      else
        token Text
      end
    end

    mixin :whitespace
  end
end
gen_delimiter_states(name, close, opts={}) click to toggle source
# File lib/rouge/lexers/tcl.rb, line 78
def self.gen_delimiter_states(name, close, opts={})
  gen_command_state("_in_#{name}")

  state :"params_in_#{name}" do
    rule close do
      token Punctuation
      pop! 2
    end

    # mismatched delimiters.  Braced strings with mismatched
    # closing delimiters should be okay, since this is standard
    # practice, like {]]]]}
    if opts[:strict]
      rule CHARS[CLOSE - [close]], Error
    else
      rule CHARS[CLOSE - [close]], Text
    end

    mixin :params
  end

  state name do
    rule close, Punctuation, :pop!
    mixin :"command_in_#{name}"
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.