class Rouge::Lexers::TCL

def self.analyze_text(text)

def self.analyze_text(text)
  return 1 if text.shebang? 'tclsh'
  return 1 if text.shebang? 'wish'
  return 1 if text.shebang? 'jimsh'
end

def self.gen_command_state(name='')

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

def self.gen_delimiter_states(name, close, opts={})

def self.gen_delimiter_states(name, close, opts={})
  gen_command_state("_in_#{name}")
  state :"params_in_#{name}" do
    rule close do
      token 'Punctuation'
      pop!; pop!
    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