rouge-2.2.1/0000755000175000017500000000000013150713277012477 5ustar uwabamiuwabamirouge-2.2.1/bin/0000755000175000017500000000000013150713277013247 5ustar uwabamiuwabamirouge-2.2.1/bin/rougify0000755000175000017500000000061713150713277014665 0ustar uwabamiuwabami#!/usr/bin/env ruby require 'pathname' ROOT_DIR = Pathname.new(__FILE__).dirname.parent load ROOT_DIR.join('lib/rouge.rb') load ROOT_DIR.join('lib/rouge/cli.rb') Signal.trap('PIPE', 'SYSTEM_DEFAULT') if Signal.list.include? 'PIPE' begin Rouge::CLI.parse(ARGV).run rescue Rouge::CLI::Error => e puts e.message exit e.status rescue Interrupt $stderr.puts "\nrouge: interrupted" exit 2 end rouge-2.2.1/Gemfile0000644000175000017500000000062013150713277013770 0ustar uwabamiuwabamisource 'http://rubygems.org' gemspec gem 'bundler', '~> 1.15' gem 'rake', '~> 12.0' gem 'minitest', '~> 4.0' gem 'wrong' gem 'rubocop', '~> 0.49.1' if RUBY_VERSION >= '2.0.0' # don't try to install redcarpet under jruby gem 'redcarpet', :platforms => :ruby group :development do gem 'pry' # docs gem 'yard' gem 'github-markup' # for visual tests gem 'sinatra' gem 'shotgun' end rouge-2.2.1/rouge.gemspec0000644000175000017500000000120113150713277015157 0ustar uwabamiuwabamirequire './lib/rouge/version' Gem::Specification.new do |s| s.name = "rouge" s.version = Rouge.version s.authors = ["Jeanine Adkisson"] s.email = ["jneen@jneen.net"] s.summary = "A pure-ruby colorizer based on pygments" s.description = <<-desc.strip.gsub(/\s+/, ' ') Rouge aims to a be a simple, easy-to-extend drop-in replacement for pygments. desc s.homepage = "http://rouge.jneen.net/" s.rubyforge_project = "rouge" s.files = Dir['Gemfile', 'LICENSE', 'rouge.gemspec', 'lib/**/*.rb', 'lib/**/*.yml', 'bin/rougify', 'lib/rouge/demos/*'] s.executables = %w(rougify) s.licenses = ['MIT', 'BSD-2-Clause'] end rouge-2.2.1/lib/0000755000175000017500000000000013150713277013245 5ustar uwabamiuwabamirouge-2.2.1/lib/rouge/0000755000175000017500000000000013150713277014366 5ustar uwabamiuwabamirouge-2.2.1/lib/rouge/theme.rb0000644000175000017500000001066113150713277016021 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge class Theme include Token::Tokens class Style < Hash def initialize(theme, hsh={}) super() @theme = theme merge!(hsh) end [:fg, :bg].each do |mode| define_method mode do return self[mode] unless @theme @theme.palette(self[mode]) if self[mode] end end def render(selector, &b) return enum_for(:render, selector).to_a.join("\n") unless b return if empty? yield "#{selector} {" rendered_rules.each do |rule| yield " #{rule};" end yield "}" end def rendered_rules(&b) return enum_for(:rendered_rules) unless b yield "color: #{fg}" if fg yield "background-color: #{bg}" if bg yield "font-weight: bold" if self[:bold] yield "font-style: italic" if self[:italic] yield "text-decoration: underline" if self[:underline] (self[:rules] || []).each(&b) end end def styles @styles ||= self.class.styles.dup end @palette = {} def self.palette(arg={}) @palette ||= InheritableHash.new(superclass.palette) if arg.is_a? Hash @palette.merge! arg @palette else case arg when /#[0-9a-f]+/i arg else @palette[arg] or raise "not in palette: #{arg.inspect}" end end end def palette(*a) self.class.palette(*a) end @styles = {} def self.styles @styles ||= InheritableHash.new(superclass.styles) end def self.render(opts={}, &b) new(opts).render(&b) end def get_own_style(token) self.class.get_own_style(token) end def get_style(token) self.class.get_style(token) end class << self def style(*tokens) style = tokens.last.is_a?(Hash) ? tokens.pop : {} tokens.each do |tok| styles[tok] = style end end def get_own_style(token) token.token_chain.reverse_each do |anc| return Style.new(self, styles[anc]) if styles[anc] end nil end def get_style(token) get_own_style(token) || base_style end def base_style get_own_style(Token::Tokens::Text) end def name(n=nil) return @name if n.nil? @name = n.to_s register(@name) end def register(name) Theme.registry[name.to_s] = self end def find(n) registry[n.to_s] end def registry @registry ||= {} end end end module HasModes def mode(arg=:absent) return @mode if arg == :absent @modes ||= {} @modes[arg] ||= get_mode(arg) end def get_mode(mode) return self if self.mode == mode new_name = "#{self.name}.#{mode}" Class.new(self) { name(new_name); set_mode!(mode) } end def set_mode!(mode) @mode = mode send("make_#{mode}!") end def mode!(arg) alt_name = "#{self.name}.#{arg}" register(alt_name) set_mode!(arg) end end class CSSTheme < Theme def initialize(opts={}) @scope = opts[:scope] || '.highlight' end def render(&b) return enum_for(:render).to_a.join("\n") unless b # shared styles for tableized line numbers yield "#{@scope} table td { padding: 5px; }" yield "#{@scope} table pre { margin: 0; }" styles.each do |tok, style| Style.new(self, style).render(css_selector(tok), &b) end end def render_base(selector, &b) self.class.base_style.render(selector, &b) end def style_for(tok) self.class.get_style(tok) end private def css_selector(token) inflate_token(token).map do |tok| raise "unknown token: #{tok.inspect}" if tok.shortname.nil? single_css_selector(tok) end.join(', ') end def single_css_selector(token) return @scope if token == Text "#{@scope} .#{token.shortname}" end # yield all of the tokens that should be styled the same # as the given token. Essentially this recursively all of # the subtokens, except those which are more specifically # styled. def inflate_token(tok, &b) return enum_for(:inflate_token, tok) unless block_given? yield tok tok.sub_tokens.each do |(_, st)| next if styles[st] inflate_token(st, &b) end end end end rouge-2.2.1/lib/rouge/formatter.rb0000644000175000017500000000307013150713277016716 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge # A Formatter takes a token stream and formats it for human viewing. class Formatter # @private REGISTRY = {} # Specify or get the unique tag for this formatter. This is used # for specifying a formatter in `rougify`. def self.tag(tag=nil) return @tag unless tag REGISTRY[tag] = self @tag = tag end # Find a formatter class given a unique tag. def self.find(tag) REGISTRY[tag] end # Format a token stream. Delegates to {#format}. def self.format(tokens, *a, &b) new(*a).format(tokens, &b) end def initialize(opts={}) # pass end # Format a token stream. def format(tokens, &b) return stream(tokens, &b) if block_given? out = '' stream(tokens) { |piece| out << piece } out end # @deprecated Use {#format} instead. def render(tokens) warn 'Formatter#render is deprecated, use #format instead.' format(tokens) end # @abstract # yield strings that, when concatenated, form the formatted output def stream(tokens, &b) raise 'abstract' end protected def token_lines(tokens, &b) return enum_for(:token_lines, tokens) unless block_given? out = [] tokens.each do |tok, val| val.scan /\n|[^\n]+/ do |s| if s == "\n" yield out out = [] else out << [tok, s] end end end # for inputs not ending in a newline yield out if out.any? end end end rouge-2.2.1/lib/rouge/regex_lexer.rb0000644000175000017500000003112513150713277017226 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge # @abstract # A stateful lexer that uses sets of regular expressions to # tokenize a string. Most lexers are instances of RegexLexer. class RegexLexer < Lexer # A rule is a tuple of a regular expression to test, and a callback # to perform if the test succeeds. # # @see StateDSL#rule class Rule attr_reader :callback attr_reader :re attr_reader :beginning_of_line def initialize(re, callback) @re = re @callback = callback @beginning_of_line = re.source[0] == ?^ end def inspect "#" end end # a State is a named set of rules that can be tested for or # mixed in. # # @see RegexLexer.state class State attr_reader :name, :rules def initialize(name, rules) @name = name @rules = rules end def inspect "#<#{self.class.name} #{@name.inspect}>" end end class StateDSL attr_reader :rules def initialize(name, &defn) @name = name @defn = defn @rules = [] @loaded = false end def to_state(lexer_class) load! rules = @rules.map do |rule| rule.is_a?(String) ? lexer_class.get_state(rule) : rule end State.new(@name, rules) end def prepended(&defn) parent_defn = @defn StateDSL.new(@name) do instance_eval(&defn) instance_eval(&parent_defn) end end def appended(&defn) parent_defn = @defn StateDSL.new(@name) do instance_eval(&parent_defn) instance_eval(&defn) end end protected # Define a new rule for this state. # # @overload rule(re, token, next_state=nil) # @overload rule(re, &callback) # # @param [Regexp] re # a regular expression for this rule to test. # @param [String] tok # the token type to yield if `re` matches. # @param [#to_s] next_state # (optional) a state to push onto the stack if `re` matches. # If `next_state` is `:pop!`, the state stack will be popped # instead. # @param [Proc] callback # a block that will be evaluated in the context of the lexer # if `re` matches. This block has access to a number of lexer # methods, including {RegexLexer#push}, {RegexLexer#pop!}, # {RegexLexer#token}, and {RegexLexer#delegate}. The first # argument can be used to access the match groups. def rule(re, tok=nil, next_state=nil, &callback) if tok.nil? && callback.nil? raise "please pass `rule` a token to yield or a callback" end callback ||= case next_state when :pop! proc do |stream| puts " yielding #{tok.qualname}, #{stream[0].inspect}" if @debug @output_stream.call(tok, stream[0]) puts " popping stack: 1" if @debug @stack.pop or raise 'empty stack!' end when :push proc do |stream| puts " yielding #{tok.qualname}, #{stream[0].inspect}" if @debug @output_stream.call(tok, stream[0]) puts " pushing :#{@stack.last.name}" if @debug @stack.push(@stack.last) end when Symbol proc do |stream| puts " yielding #{tok.qualname}, #{stream[0].inspect}" if @debug @output_stream.call(tok, stream[0]) state = @states[next_state] || self.class.get_state(next_state) puts " pushing :#{state.name}" if @debug @stack.push(state) end when nil proc do |stream| puts " yielding #{tok.qualname}, #{stream[0].inspect}" if @debug @output_stream.call(tok, stream[0]) end else raise "invalid next state: #{next_state.inspect}" end rules << Rule.new(re, callback) end # Mix in the rules from another state into this state. The rules # from the mixed-in state will be tried in order before moving on # to the rest of the rules in this state. def mixin(state) rules << state.to_s end private def load! return if @loaded @loaded = true instance_eval(&@defn) end end # The states hash for this lexer. # @see state def self.states @states ||= {} end def self.state_definitions @state_definitions ||= InheritableHash.new(superclass.state_definitions) end @state_definitions = {} def self.replace_state(name, new_defn) states[name] = nil state_definitions[name] = new_defn end # The routines to run at the beginning of a fresh lex. # @see start def self.start_procs @start_procs ||= InheritableList.new(superclass.start_procs) end @start_procs = [] # Specify an action to be run every fresh lex. # # @example # start { puts "I'm lexing a new string!" } def self.start(&b) start_procs << b end # Define a new state for this lexer with the given name. # The block will be evaluated in the context of a {StateDSL}. def self.state(name, &b) name = name.to_s state_definitions[name] = StateDSL.new(name, &b) end def self.prepend(name, &b) name = name.to_s dsl = state_definitions[name] or raise "no such state #{name.inspect}" replace_state(name, dsl.prepended(&b)) end def self.append(name, &b) name = name.to_s dsl = state_definitions[name] or raise "no such state #{name.inspect}" replace_state(name, dsl.appended(&b)) end # @private def self.get_state(name) return name if name.is_a? State states[name.to_sym] ||= begin defn = state_definitions[name.to_s] or raise "unknown state: #{name.inspect}" defn.to_state(self) end end # @private def get_state(state_name) self.class.get_state(state_name) end # The state stack. This is initially the single state `[:root]`. # It is an error for this stack to be empty. # @see #state def stack @stack ||= [get_state(:root)] end # The current state - i.e. one on top of the state stack. # # NB: if the state stack is empty, this will throw an error rather # than returning nil. def state stack.last or raise 'empty stack!' end # reset this lexer to its initial state. This runs all of the # start_procs. def reset! @stack = nil @current_stream = nil puts "start blocks" if @debug && self.class.start_procs.any? self.class.start_procs.each do |pr| instance_eval(&pr) end end # This implements the lexer protocol, by yielding [token, value] pairs. # # The process for lexing works as follows, until the stream is empty: # # 1. We look at the state on top of the stack (which by default is # `[:root]`). # 2. Each rule in that state is tried until one is successful. If one # is found, that rule's callback is evaluated - which may yield # tokens and manipulate the state stack. Otherwise, one character # is consumed with an `'Error'` token, and we continue at (1.) # # @see #step #step (where (2.) is implemented) def stream_tokens(str, &b) stream = StringScanner.new(str) @current_stream = stream @output_stream = b @states = self.class.states @null_steps = 0 until stream.eos? if @debug puts "lexer: #{self.class.tag}" puts "stack: #{stack.map(&:name).map(&:to_sym).inspect}" puts "stream: #{stream.peek(20).inspect}" end success = step(state, stream) if !success puts " no match, yielding Error" if @debug b.call(Token::Tokens::Error, stream.getch) end end end # The number of successive scans permitted without consuming # the input stream. If this is exceeded, the match fails. MAX_NULL_SCANS = 5 # Runs one step of the lex. Rules in the current state are tried # until one matches, at which point its callback is called. # # @return true if a rule was tried successfully # @return false otherwise. def step(state, stream) state.rules.each do |rule| if rule.is_a?(State) puts " entering mixin #{rule.name}" if @debug return true if step(rule, stream) puts " exiting mixin #{rule.name}" if @debug else puts " trying #{rule.inspect}" if @debug # XXX HACK XXX # StringScanner's implementation of ^ is b0rken. # see http://bugs.ruby-lang.org/issues/7092 # TODO: this doesn't cover cases like /(a|^b)/, but it's # the most common, for now... next if rule.beginning_of_line && !stream.beginning_of_line? if (size = stream.skip(rule.re)) puts " got #{stream[0].inspect}" if @debug instance_exec(stream, &rule.callback) if size.zero? @null_steps += 1 if @null_steps > MAX_NULL_SCANS puts " too many scans without consuming the string!" if @debug return false end else @null_steps = 0 end return true end end end false end # Yield a token. # # @param tok # the token type # @param val # (optional) the string value to yield. If absent, this defaults # to the entire last match. def token(tok, val=@current_stream[0]) yield_token(tok, val) end # @deprecated # # Yield a token with the next matched group. Subsequent calls # to this method will yield subsequent groups. def group(tok) raise "RegexLexer#group is deprecated: use #groups instead" end # Yield tokens corresponding to the matched groups of the current # match. def groups(*tokens) tokens.each_with_index do |tok, i| yield_token(tok, @current_stream[i+1]) end end # Delegate the lex to another lexer. The #lex method will be called # with `:continue` set to true, so that #reset! will not be called. # In this way, a single lexer can be repeatedly delegated to while # maintaining its own internal state stack. # # @param [#lex] lexer # The lexer or lexer class to delegate to # @param [String] text # The text to delegate. This defaults to the last matched string. def delegate(lexer, text=nil) puts " delegating to #{lexer.inspect}" if @debug text ||= @current_stream[0] lexer.lex(text, :continue => true) do |tok, val| puts " delegated token: #{tok.inspect}, #{val.inspect}" if @debug yield_token(tok, val) end end def recurse(text=nil) delegate(self.class, text) end # Push a state onto the stack. If no state name is given and you've # passed a block, a state will be dynamically created using the # {StateDSL}. def push(state_name=nil, &b) push_state = if state_name get_state(state_name) elsif block_given? StateDSL.new(b.inspect, &b).to_state(self.class) else # use the top of the stack by default self.state end puts " pushing :#{push_state.name}" if @debug stack.push(push_state) end # Pop the state stack. If a number is passed in, it will be popped # that number of times. def pop!(times=1) raise 'empty stack!' if stack.empty? puts " popping stack: #{times}" if @debug stack.pop(times) nil end # replace the head of the stack with the given state def goto(state_name) raise 'empty stack!' if stack.empty? puts " going to state :#{state_name} " if @debug stack[-1] = get_state(state_name) end # reset the stack back to `[:root]`. def reset_stack puts ' resetting stack' if @debug stack.clear stack.push get_state(:root) end # Check if `state_name` is in the state stack. def in_state?(state_name) state_name = state_name.to_s stack.any? do |state| state.name == state_name.to_s end end # Check if `state_name` is the state on top of the state stack. def state?(state_name) state_name.to_s == state.name end private def yield_token(tok, val) return if val.nil? || val.empty? puts " yielding #{tok.qualname}, #{val.inspect}" if @debug @output_stream.yield(tok, val) end end end rouge-2.2.1/lib/rouge/guessers/0000755000175000017500000000000013150713277016226 5ustar uwabamiuwabamirouge-2.2.1/lib/rouge/guessers/source.rb0000644000175000017500000000202313150713277020050 0ustar uwabamiuwabamimodule Rouge module Guessers class Source < Guesser attr_reader :source def initialize(source) @source = source end def filter(lexers) # don't bother reading the input if # we've already filtered to 1 return lexers if lexers.size == 1 # If we're filtering against *all* lexers, we only use confident return # values from analyze_text. But if we've filtered down already, we can trust # the analysis more. threshold = lexers.size < 10 ? 0 : 0.5 source_text = case @source when String @source when ->(s){ s.respond_to? :read } @source.read else raise 'invalid source' end Lexer.assert_utf8!(source_text) source_text = TextAnalyzer.new(source_text) collect_best(lexers, threshold: threshold) do |lexer| next unless lexer.methods(false).include? :analyze_text lexer.analyze_text(source_text) end end end end end rouge-2.2.1/lib/rouge/guessers/mimetype.rb0000644000175000017500000000043113150713277020402 0ustar uwabamiuwabamimodule Rouge module Guessers class Mimetype < Guesser attr_reader :mimetype def initialize(mimetype) @mimetype = mimetype end def filter(lexers) lexers.select { |lexer| lexer.mimetypes.include? @mimetype } end end end end rouge-2.2.1/lib/rouge/guessers/modeline.rb0000644000175000017500000000304213150713277020346 0ustar uwabamiuwabamimodule Rouge module Guessers class Modeline < Guesser # [jneen] regexen stolen from linguist EMACS_MODELINE = /-\*-\s*(?:(?!mode)[\w-]+\s*:\s*(?:[\w+-]+)\s*;?\s*)*(?:mode\s*:)?\s*([\w+-]+)\s*(?:;\s*(?!mode)[\w-]+\s*:\s*[\w+-]+\s*)*;?\s*-\*-/i # First form vim modeline # [text]{white}{vi:|vim:|ex:}[white]{options} # ex: 'vim: syntax=ruby' VIM_MODELINE_1 = /(?:vim|vi|ex):\s*(?:ft|filetype|syntax)=(\w+)\s?/i # Second form vim modeline (compatible with some versions of Vi) # [text]{white}{vi:|vim:|Vim:|ex:}[white]se[t] {options}:[text] # ex: 'vim set syntax=ruby:' VIM_MODELINE_2 = /(?:vim|vi|Vim|ex):\s*se(?:t)?.*\s(?:ft|filetype|syntax)=(\w+)\s?.*:/i MODELINES = [EMACS_MODELINE, VIM_MODELINE_1, VIM_MODELINE_2] def initialize(source, opts={}) @source = source @lines = opts[:lines] || 5 end def filter(lexers) # don't bother reading the stream if we've already decided return lexers if lexers.size == 1 source_text = @source source_text = source_text.read if source_text.respond_to? :read lines = source_text.split(/\r?\n/) search_space = (lines.first(@lines) + lines.last(@lines)).join("\n") matches = MODELINES.map { |re| re.match(search_space) }.compact return lexers unless matches.any? match_set = Set.new(matches.map { |m| m[1] }) lexers.select { |l| match_set.include?(l.tag) || l.aliases.any? { |a| match_set.include?(a) } } end end end end rouge-2.2.1/lib/rouge/guessers/glob_mapping.rb0000644000175000017500000000225613150713277021216 0ustar uwabamiuwabamimodule Rouge module Guessers # This class allows for custom behavior # with glob -> lexer name mappings class GlobMapping < Guesser def self.by_pairs(mapping, filename) glob_map = {} mapping.each do |(glob, lexer_name)| lexer = Lexer.find(lexer_name) # ignore unknown lexers next unless lexer glob_map[lexer.name] ||= [] glob_map[lexer.name] << glob end new(glob_map, filename) end attr_reader :glob_map, :filename def initialize(glob_map, filename) @glob_map = glob_map @filename = filename end def filter(lexers) basename = File.basename(filename) collect_best(lexers) do |lexer| score = (@glob_map[lexer.name] || []).map do |pattern| if test_pattern(pattern, basename) # specificity is better the fewer wildcards there are -pattern.scan(/[*?\[]/).size end end.compact.min end end private def test_pattern(pattern, path) File.fnmatch?(pattern, path, File::FNM_DOTMATCH | File::FNM_CASEFOLD) end end end end rouge-2.2.1/lib/rouge/guessers/filename.rb0000644000175000017500000000140613150713277020334 0ustar uwabamiuwabamimodule Rouge module Guessers class Filename < Guesser attr_reader :fname def initialize(filename) @filename = filename end # returns a list of lexers that match the given filename with # equal specificity (i.e. number of wildcards in the pattern). # This helps disambiguate between, e.g. the Nginx lexer, which # matches `nginx.conf`, and the Conf lexer, which matches `*.conf`. # In this case, nginx will win because the pattern has no wildcards, # while `*.conf` has one. def filter(lexers) mapping = {} lexers.each do |lexer| mapping[lexer.name] = lexer.filenames || [] end GlobMapping.new(mapping, @filename).filter(lexers) end end end end rouge-2.2.1/lib/rouge/lexer.rb0000644000175000017500000002650713150713277016044 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # # stdlib require 'strscan' require 'cgi' require 'set' module Rouge # @abstract # A lexer transforms text into a stream of `[token, chunk]` pairs. class Lexer include Token::Tokens @option_docs = {} class << self # Lexes `stream` with the given options. The lex is delegated to a # new instance. # # @see #lex def lex(stream, opts={}, &b) new(opts).lex(stream, &b) end # Given a string, return the correct lexer class. def find(name) registry[name.to_s] end # Find a lexer, with fancy shiny features. # # * The string you pass can include CGI-style options # # Lexer.find_fancy('erb?parent=tex') # # * You can pass the special name 'guess' so we guess for you, # and you can pass a second argument of the code to guess by # # Lexer.find_fancy('guess', "#!/bin/bash\necho Hello, world") # # This is used in the Redcarpet plugin as well as Rouge's own # markdown lexer for highlighting internal code blocks. # def find_fancy(str, code=nil, additional_options={}) if str && !str.include?('?') && str != 'guess' lexer_class = find(str) return lexer_class && lexer_class.new(additional_options) end name, opts = str ? str.split('?', 2) : [nil, ''] # parse the options hash from a cgi-style string opts = CGI.parse(opts || '').map do |k, vals| val = case vals.size when 0 then true when 1 then vals[0] else vals end [ k.to_s, val ] end opts = additional_options.merge(Hash[opts]) lexer_class = case name when 'guess', nil self.guess(:source => code, :mimetype => opts['mimetype']) when String self.find(name) end lexer_class && lexer_class.new(opts) end # Specify or get this lexer's title. Meant to be human-readable. def title(t=nil) if t.nil? t = tag.capitalize end @title ||= t end # Specify or get this lexer's description. def desc(arg=:absent) if arg == :absent @desc else @desc = arg end end def option_docs @option_docs ||= InheritableHash.new(superclass.option_docs) end def option(name, desc) option_docs[name.to_s] = desc end # Specify or get the path name containing a small demo for # this lexer (can be overriden by {demo}). def demo_file(arg=:absent) return @demo_file = Pathname.new(arg) unless arg == :absent @demo_file = Pathname.new(__FILE__).dirname.join('demos', tag) end # Specify or get a small demo string for this lexer def demo(arg=:absent) return @demo = arg unless arg == :absent @demo = File.read(demo_file, encoding: 'utf-8') end # @return a list of all lexers. def all registry.values.uniq end # Guess which lexer to use based on a hash of info. # # This accepts the same arguments as Lexer.guess, but will never throw # an error. It will return a (possibly empty) list of potential lexers # to use. def guesses(info={}) mimetype, filename, source = info.values_at(:mimetype, :filename, :source) custom_globs = info[:custom_globs] guessers = (info[:guessers] || []).dup guessers << Guessers::Mimetype.new(mimetype) if mimetype guessers << Guessers::GlobMapping.by_pairs(custom_globs, filename) if custom_globs && filename guessers << Guessers::Filename.new(filename) if filename guessers << Guessers::Modeline.new(source) if source guessers << Guessers::Source.new(source) if source Guesser.guess(guessers, Lexer.all) end # Guess which lexer to use based on a hash of info. # # @option info :mimetype # A mimetype to guess by # @option info :filename # A filename to guess by # @option info :source # The source itself, which, if guessing by mimetype or filename # fails, will be searched for shebangs, tags, and # other hints. # # @see Lexer.analyze_text # @see Lexer.guesses def guess(info={}) lexers = guesses(info) return Lexers::PlainText if lexers.empty? return lexers[0] if lexers.size == 1 raise Guesser::Ambiguous.new(lexers) end def guess_by_mimetype(mt) guess :mimetype => mt end def guess_by_filename(fname) guess :filename => fname end def guess_by_source(source) guess :source => source end def enable_debug! @debug_enabled = true end def disable_debug! @debug_enabled = false end def debug_enabled? !!@debug_enabled end protected # @private def register(name, lexer) registry[name.to_s] = lexer end public # Used to specify or get the canonical name of this lexer class. # # @example # class MyLexer < Lexer # tag 'foo' # end # # MyLexer.tag # => 'foo' # # Lexer.find('foo') # => MyLexer def tag(t=nil) return @tag if t.nil? @tag = t.to_s Lexer.register(@tag, self) end # Used to specify alternate names this lexer class may be found by. # # @example # class Erb < Lexer # tag 'erb' # aliases 'eruby', 'rhtml' # end # # Lexer.find('eruby') # => Erb def aliases(*args) args.map!(&:to_s) args.each { |arg| Lexer.register(arg, self) } (@aliases ||= []).concat(args) end # Specify a list of filename globs associated with this lexer. # # @example # class Ruby < Lexer # filenames '*.rb', '*.ruby', 'Gemfile', 'Rakefile' # end def filenames(*fnames) (@filenames ||= []).concat(fnames) end # Specify a list of mimetypes associated with this lexer. # # @example # class Html < Lexer # mimetypes 'text/html', 'application/xhtml+xml' # end def mimetypes(*mts) (@mimetypes ||= []).concat(mts) end # @private def assert_utf8!(str) return if %w(US-ASCII UTF-8 ASCII-8BIT).include? str.encoding.name raise EncodingError.new( "Bad encoding: #{str.encoding.names.join(',')}. " + "Please convert your string to UTF-8." ) end private def registry @registry ||= {} end end # -*- instance methods -*- # attr_reader :options # Create a new lexer with the given options. Individual lexers may # specify extra options. The only current globally accepted option # is `:debug`. # # @option opts :debug # Prints debug information to stdout. The particular info depends # on the lexer in question. In regex lexers, this will log the # state stack at the beginning of each step, along with each regex # tried and each stream consumed. Try it, it's pretty useful. def initialize(opts={}) @options = {} opts.each { |k, v| @options[k.to_s] = v } @debug = Lexer.debug_enabled? && bool_option(:debug) end def as_bool(val) case val when nil, false, 0, '0', 'off' false when Array val.empty? ? true : as_bool(val.last) else true end end def as_string(val) return as_string(val.last) if val.is_a?(Array) val ? val.to_s : nil end def as_list(val) case val when Array val.flat_map { |v| as_list(v) } when String val.split(',') else [] end end def as_lexer(val) return as_lexer(val.last) if val.is_a?(Array) return val.new(@options) if val.is_a?(Class) && val < Lexer case val when Lexer val when String lexer_class = Lexer.find(val) lexer_class && lexer_class.new(@options) end end def as_token(val) return as_token(val.last) if val.is_a?(Array) case val when Token val else Token[val] end end def bool_option(name, &default) if @options.key?(name.to_s) as_bool(@options[name.to_s]) else default ? default.call : false end end def string_option(name, &default) as_string(@options.delete(name.to_s, &default)) end def lexer_option(name, &default) as_lexer(@options.delete(name.to_s, &default)) end def list_option(name, &default) as_list(@options.delete(name.to_s, &default)) end def token_option(name, &default) as_token(@options.delete(name.to_s, &default)) end def hash_option(name, defaults, &val_cast) name = name.to_s out = defaults.dup base = @options.delete(name.to_s) base = {} unless base.is_a?(Hash) base.each { |k, v| out[k.to_s] = val_cast ? val_cast.call(v) : v } @options.keys.each do |key| next unless key =~ /(\w+)\[(\w+)\]/ and $1 == name value = @options.delete(key) out[$2] = val_cast ? val_cast.call(value) : value end out end # @abstract # # Called after each lex is finished. The default implementation # is a noop. def reset! end # Given a string, yield [token, chunk] pairs. If no block is given, # an enumerator is returned. # # @option opts :continue # Continue the lex from the previous state (i.e. don't call #reset!) def lex(string, opts={}, &b) return enum_for(:lex, string, opts) unless block_given? Lexer.assert_utf8!(string) reset! unless opts[:continue] # consolidate consecutive tokens of the same type last_token = nil last_val = nil stream_tokens(string) do |tok, val| next if val.empty? if tok == last_token last_val << val next end b.call(last_token, last_val) if last_token last_token = tok last_val = val end b.call(last_token, last_val) if last_token end # delegated to {Lexer.tag} def tag self.class.tag end # @abstract # # Yield `[token, chunk]` pairs, given a prepared input stream. This # must be implemented. # # @param [StringScanner] stream # the stream def stream_tokens(stream, &b) raise 'abstract' end # @abstract # # Return a number between 0 and 1 indicating the likelihood that # the text given should be lexed with this lexer. The default # implementation returns 0. Values under 0.5 will only be used # to disambiguate filename or mimetype matches. # # @param [TextAnalyzer] text # the text to be analyzed, with a couple of handy methods on it, # like {TextAnalyzer#shebang?} and {TextAnalyzer#doctype?} def self.analyze_text(text) 0 end end module Lexers @_loaded_lexers = {} def self.load_lexer(relpath) return if @_loaded_lexers.key?(relpath) @_loaded_lexers[relpath] = true root = Pathname.new(__FILE__).dirname.join('lexers') load root.join(relpath) end end end rouge-2.2.1/lib/rouge/text_analyzer.rb0000644000175000017500000000233713150713277017611 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge class TextAnalyzer < String # Find a shebang. Returns nil if no shebang is present. def shebang return @shebang if instance_variable_defined? :@shebang self =~ /\A\s*#!(.*)$/ @shebang = $1 end # Check if the given shebang is present. # # This normalizes things so that `text.shebang?('bash')` will detect # `#!/bash`, '#!/bin/bash', '#!/usr/bin/env bash', and '#!/bin/bash -x' def shebang?(match) return false unless shebang match = /\b#{match}(\s|$)/ match === shebang end # Return the contents of the doctype tag if present, nil otherwise. def doctype return @doctype if instance_variable_defined? :@doctype self =~ %r(\A\s* (?:<\?.*?\?>\s*)? # possible tag )xm @doctype = $1 end # Check if the doctype matches a given regexp or string def doctype?(type=//) type === doctype end # Return true if the result of lexing with the given lexer contains no # error tokens. def lexes_cleanly?(lexer) lexer.lex(self) do |(tok, _)| return false if tok.name == 'Error' end true end end end rouge-2.2.1/lib/rouge/themes/0000755000175000017500000000000013150713277015653 5ustar uwabamiuwabamirouge-2.2.1/lib/rouge/themes/tulip.rb0000644000175000017500000000470213150713277017340 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Themes class Tulip < CSSTheme name 'tulip' palette :purple => '#766DAF' palette :lpurple => '#9f93e6' palette :orange => '#FAAF4C' palette :green => '#3FB34F' palette :lgreen => '#41ff5b' palette :yellow => '#FFF02A' palette :black => '#000000' palette :gray => '#6D6E70' palette :red => '#CC0000' palette :dark_purple => '#231529' palette :lunicorn => '#faf8ed' palette :white => '#FFFFFF' palette :earth => '#181a27' palette :dune => '#fff0a6' style Text, :fg => :white, :bg => :dark_purple style Comment, :fg => :gray, :italic => true style Comment::Preproc, :fg => :lgreen, :bold => true, :italic => true style Error, Generic::Error, :fg => :white, :bg => :red style Keyword, :fg => :yellow, :bold => true style Operator, Punctuation, :fg => :lgreen style Generic::Deleted, :fg => :red style Generic::Inserted, :fg => :green style Generic::Emph, :italic => true style Generic::Strong, :bold => true style Generic::Traceback, Generic::Lineno, :fg => :white, :bg => :purple style Keyword::Constant, :fg => :lpurple, :bold => true style Keyword::Namespace, Keyword::Pseudo, Keyword::Reserved, Generic::Heading, Generic::Subheading, :fg => :white, :bold => true style Keyword::Type, Name::Constant, Name::Class, Name::Decorator, Name::Namespace, Name::Builtin::Pseudo, Name::Exception, :fg => :orange, :bold => true style Name::Label, Name::Tag, :fg => :lpurple, :bold => true style Literal::Number, Literal::Date, Literal::String::Symbol, :fg => :lpurple, :bold => true style Literal::String, :fg => :dune, :bold => true style Literal::String::Escape, Literal::String::Char, Literal::String::Interpol, :fg => :orange, :bold => true style Name::Builtin, :bold => true style Name::Entity, :fg => '#999999', :bold => true style Text::Whitespace, :fg => '#BBBBBB' style Name::Function, Name::Property, Name::Attribute, :fg => :lgreen style Name::Variable, :fg => :lgreen, :bold => true end end end rouge-2.2.1/lib/rouge/themes/igor_pro.rb0000644000175000017500000000136313150713277020023 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Themes class IgorPro < CSSTheme name 'igorpro' style Text, :fg => '#444444' style Comment::Preproc, :fg => '#CC00A3' style Comment::Special, :fg => '#CC00A3' style Comment, :fg => '#FF0000' style Keyword::Constant, :fg => '#C34E00' style Keyword::Declaration, :fg => '#0000FF' style Keyword::Reserved, :fg => '#007575' style Keyword, :fg => '#0000FF' style Literal::String, :fg => '#009C00' style Name::Builtin, :fg => '#C34E00' end end end rouge-2.2.1/lib/rouge/themes/colorful.rb0000644000175000017500000000620013150713277020023 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Themes # stolen from pygments class Colorful < CSSTheme name 'colorful' style Text, :fg => "#bbbbbb", :bg => '#000' style Comment, :fg => "#888" style Comment::Preproc, :fg => "#579" style Comment::Special, :fg => "#cc0000", :bold => true style Keyword, :fg => "#080", :bold => true style Keyword::Pseudo, :fg => "#038" style Keyword::Type, :fg => "#339" style Operator, :fg => "#333" style Operator::Word, :fg => "#000", :bold => true style Name::Builtin, :fg => "#007020" style Name::Function, :fg => "#06B", :bold => true style Name::Class, :fg => "#B06", :bold => true style Name::Namespace, :fg => "#0e84b5", :bold => true style Name::Exception, :fg => "#F00", :bold => true style Name::Variable, :fg => "#963" style Name::Variable::Instance, :fg => "#33B" style Name::Variable::Class, :fg => "#369" style Name::Variable::Global, :fg => "#d70", :bold => true style Name::Constant, :fg => "#036", :bold => true style Name::Label, :fg => "#970", :bold => true style Name::Entity, :fg => "#800", :bold => true style Name::Attribute, :fg => "#00C" style Name::Tag, :fg => "#070" style Name::Decorator, :fg => "#555", :bold => true style Literal::String, :bg => "#fff0f0" style Literal::String::Char, :fg => "#04D" style Literal::String::Doc, :fg => "#D42" style Literal::String::Interpol, :bg => "#eee" style Literal::String::Escape, :fg => "#666", :bold => true style Literal::String::Regex, :fg => "#000", :bg => "#fff0ff" style Literal::String::Symbol, :fg => "#A60" style Literal::String::Other, :fg => "#D20" style Literal::Number, :fg => "#60E", :bold => true style Literal::Number::Integer, :fg => "#00D", :bold => true style Literal::Number::Float, :fg => "#60E", :bold => true style Literal::Number::Hex, :fg => "#058", :bold => true style Literal::Number::Oct, :fg => "#40E", :bold => true style Generic::Heading, :fg => "#000080", :bold => true style Generic::Subheading, :fg => "#800080", :bold => true style Generic::Deleted, :fg => "#A00000" style Generic::Inserted, :fg => "#00A000" style Generic::Error, :fg => "#FF0000" style Generic::Emph, :italic => true style Generic::Strong, :bold => true style Generic::Prompt, :fg => "#c65d09", :bold => true style Generic::Output, :fg => "#888" style Generic::Traceback, :fg => "#04D" style Error, :fg => "#F00", :bg => "#FAA" end end end rouge-2.2.1/lib/rouge/themes/molokai.rb0000644000175000017500000000646513150713277017646 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Themes class Molokai < CSSTheme name 'molokai' palette :black => '#1b1d1e' palette :white => '#f8f8f2' palette :blue => '#66d9ef' palette :green => '#a6e22e' palette :grey => '#403d3d' palette :red => '#f92672' palette :light_grey => '#465457' palette :dark_blue => '#5e5d83' palette :violet => '#af87ff' palette :yellow => '#d7d787' style Comment, Comment::Multiline, Comment::Single, :fg => :dark_blue, :italic => true style Comment::Preproc, :fg => :light_grey, :bold => true style Comment::Special, :fg => :light_grey, :italic => true, :bold => true style Error, :fg => :white, :bg => :grey style Generic::Inserted, :fg => :green style Generic::Deleted, :fg => :red style Generic::Emph, :fg => :black, :italic => true style Generic::Error, Generic::Traceback, :fg => :red style Generic::Heading, :fg => :grey style Generic::Output, :fg => :grey style Generic::Prompt, :fg => :blue style Generic::Strong, :bold => true style Generic::Subheading, :fg => :light_grey style Keyword, Keyword::Constant, Keyword::Declaration, Keyword::Pseudo, Keyword::Reserved, Keyword::Type, :fg => :blue, :bold => true style Keyword::Namespace, Operator::Word, Operator, :fg => :red, :bold => true style Literal::Number::Float, Literal::Number::Hex, Literal::Number::Integer::Long, Literal::Number::Integer, Literal::Number::Oct, Literal::Number, Literal::String::Escape, :fg => :violet style Literal::String::Backtick, Literal::String::Char, Literal::String::Doc, Literal::String::Double, Literal::String::Heredoc, Literal::String::Interpol, Literal::String::Other, Literal::String::Regex, Literal::String::Single, Literal::String::Symbol, Literal::String, :fg => :yellow style Name::Attribute, :fg => :green style Name::Class, Name::Decorator, Name::Exception, Name::Function, :fg => :green, :bold => true style Name::Constant, :fg => :blue style Name::Builtin::Pseudo, Name::Builtin, Name::Entity, Name::Namespace, Name::Variable::Class, Name::Variable::Global, Name::Variable::Instance, Name::Variable, Text::Whitespace, :fg => :white style Name::Label, :fg => :white, :bold => true style Name::Tag, :fg => :red style Text, :fg => :white, :bg => :black end end end rouge-2.2.1/lib/rouge/themes/github.rb0000644000175000017500000001033013150713277017457 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Themes class Github < CSSTheme name 'github' style Comment::Multiline, :fg => '#999988', :italic => true style Comment::Preproc, :fg => '#999999', :bold => true style Comment::Single, :fg => '#999988', :italic => true style Comment::Special, :fg => '#999999', :italic => true, :bold => true style Comment, :fg => '#999988', :italic => true style Error, :fg => '#a61717', :bg => '#e3d2d2' style Generic::Deleted, :fg => '#000000', :bg => '#ffdddd' style Generic::Emph, :fg => '#000000', :italic => true style Generic::Error, :fg => '#aa0000' style Generic::Heading, :fg => '#999999' style Generic::Inserted, :fg => '#000000', :bg => '#ddffdd' style Generic::Output, :fg => '#888888' style Generic::Prompt, :fg => '#555555' style Generic::Strong, :bold => true style Generic::Subheading, :fg => '#aaaaaa' style Generic::Traceback, :fg => '#aa0000' style Keyword::Constant, :fg => '#000000', :bold => true style Keyword::Declaration, :fg => '#000000', :bold => true style Keyword::Namespace, :fg => '#000000', :bold => true style Keyword::Pseudo, :fg => '#000000', :bold => true style Keyword::Reserved, :fg => '#000000', :bold => true style Keyword::Type, :fg => '#445588', :bold => true style Keyword, :fg => '#000000', :bold => true style Literal::Number::Float, :fg => '#009999' style Literal::Number::Hex, :fg => '#009999' style Literal::Number::Integer::Long, :fg => '#009999' style Literal::Number::Integer, :fg => '#009999' style Literal::Number::Oct, :fg => '#009999' style Literal::Number, :fg => '#009999' style Literal::String::Backtick, :fg => '#d14' style Literal::String::Char, :fg => '#d14' style Literal::String::Doc, :fg => '#d14' style Literal::String::Double, :fg => '#d14' style Literal::String::Escape, :fg => '#d14' style Literal::String::Heredoc, :fg => '#d14' style Literal::String::Interpol, :fg => '#d14' style Literal::String::Other, :fg => '#d14' style Literal::String::Regex, :fg => '#009926' style Literal::String::Single, :fg => '#d14' style Literal::String::Symbol, :fg => '#990073' style Literal::String, :fg => '#d14' style Name::Attribute, :fg => '#008080' style Name::Builtin::Pseudo, :fg => '#999999' style Name::Builtin, :fg => '#0086B3' style Name::Class, :fg => '#445588', :bold => true style Name::Constant, :fg => '#008080' style Name::Decorator, :fg => '#3c5d5d', :bold => true style Name::Entity, :fg => '#800080' style Name::Exception, :fg => '#990000', :bold => true style Name::Function, :fg => '#990000', :bold => true style Name::Label, :fg => '#990000', :bold => true style Name::Namespace, :fg => '#555555' style Name::Tag, :fg => '#000080' style Name::Variable::Class, :fg => '#008080' style Name::Variable::Global, :fg => '#008080' style Name::Variable::Instance, :fg => '#008080' style Name::Variable, :fg => '#008080' style Operator::Word, :fg => '#000000', :bold => true style Operator, :fg => '#000000', :bold => true style Text::Whitespace, :fg => '#bbbbbb' style Text, :bg => '#f8f8f8' end end end rouge-2.2.1/lib/rouge/themes/pastie.rb0000644000175000017500000000630713150713277017473 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Themes # A port of the pastie style from Pygments. # See https://bitbucket.org/birkenfeld/pygments-main/src/default/pygments/styles/pastie.py class Pastie < CSSTheme name 'pastie' style Comment, :fg => '#888888' style Comment::Preproc, :fg => '#cc0000', :bold => true style Comment::Special, :fg => '#cc0000', :bg => '#fff0f0', :bold => true style Error, :fg => '#a61717', :bg => '#e3d2d2' style Generic::Error, :fg => '#aa0000' style Generic::Heading, :fg => '#333333' style Generic::Subheading, :fg => '#666666' style Generic::Deleted, :fg => '#000000', :bg => '#ffdddd' style Generic::Inserted, :fg => '#000000', :bg => '#ddffdd' style Generic::Emph, :italic => true style Generic::Strong, :bold => true style Generic::Lineno, :fg => '#888888' style Generic::Output, :fg => '#888888' style Generic::Prompt, :fg => '#555555' style Generic::Traceback, :fg => '#aa0000' style Keyword, :fg => '#008800', :bold => true style Keyword::Pseudo, :fg => '#008800' style Keyword::Type, :fg => '#888888', :bold => true style Num, :fg => '#0000dd', :bold => true style Str, :fg => '#dd2200', :bg => '#fff0f0' style Str::Escape, :fg => '#0044dd', :bg => '#fff0f0' style Str::Interpol, :fg => '#3333bb', :bg => '#fff0f0' style Str::Other, :fg => '#22bb22', :bg => '#f0fff0' #style Str::Regex, :fg => '#008800', :bg => '#fff0ff' # The background color on regex really doesn't look good, so let's drop it style Str::Regex, :fg => '#008800' style Str::Symbol, :fg => '#aa6600', :bg => '#fff0f0' style Name::Attribute, :fg => '#336699' style Name::Builtin, :fg => '#003388' style Name::Class, :fg => '#bb0066', :bold => true style Name::Constant, :fg => '#003366', :bold => true style Name::Decorator, :fg => '#555555' style Name::Exception, :fg => '#bb0066', :bold => true style Name::Function, :fg => '#0066bb', :bold => true #style Name::Label, :fg => '#336699', :italic => true # Name::Label is used for built-in CSS properties in Rouge, so let's drop italics style Name::Label, :fg => '#336699' style Name::Namespace, :fg => '#bb0066', :bold => true style Name::Property, :fg => '#336699', :bold => true style Name::Tag, :fg => '#bb0066', :bold => true style Name::Variable, :fg => '#336699' style Name::Variable::Global, :fg => '#dd7700' style Name::Variable::Instance, :fg => '#3333bb' style Operator::Word, :fg => '#008800' style Text, {} style Text::Whitespace, :fg => '#bbbbbb' end end end rouge-2.2.1/lib/rouge/themes/base16.rb0000644000175000017500000000664413150713277017273 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Themes # default base16 theme # by Chris Kempson (http://chriskempson.com) class Base16 < CSSTheme name 'base16' palette base00: "#151515" palette base01: "#202020" palette base02: "#303030" palette base03: "#505050" palette base04: "#b0b0b0" palette base05: "#d0d0d0" palette base06: "#e0e0e0" palette base07: "#f5f5f5" palette base08: "#ac4142" palette base09: "#d28445" palette base0A: "#f4bf75" palette base0B: "#90a959" palette base0C: "#75b5aa" palette base0D: "#6a9fb5" palette base0E: "#aa759f" palette base0F: "#8f5536" extend HasModes def self.light! mode :dark # indicate that there is a dark variant mode! :light end def self.dark! mode :light # indicate that there is a light variant mode! :dark end def self.make_dark! style Text, :fg => :base05, :bg => :base00 end def self.make_light! style Text, :fg => :base02 end light! style Error, :fg => :base00, :bg => :base08 style Comment, :fg => :base03 style Comment::Preproc, Name::Tag, :fg => :base0A style Operator, Punctuation, :fg => :base05 style Generic::Inserted, :fg => :base0B style Generic::Deleted, :fg => :base08 style Generic::Heading, :fg => :base0D, :bg => :base00, :bold => true style Keyword, :fg => :base0E style Keyword::Constant, Keyword::Type, :fg => :base09 style Keyword::Declaration, :fg => :base09 style Literal::String, :fg => :base0B style Literal::String::Regex, :fg => :base0C style Literal::String::Interpol, Literal::String::Escape, :fg => :base0F style Name::Namespace, Name::Class, Name::Constant, :fg => :base0A style Name::Attribute, :fg => :base0D style Literal::Number, Literal::String::Symbol, :fg => :base0B class Solarized < Base16 name 'base16.solarized' light! # author "Ethan Schoonover (http://ethanschoonover.com/solarized)" palette base00: "#002b36" palette base01: "#073642" palette base02: "#586e75" palette base03: "#657b83" palette base04: "#839496" palette base05: "#93a1a1" palette base06: "#eee8d5" palette base07: "#fdf6e3" palette base08: "#dc322f" palette base09: "#cb4b16" palette base0A: "#b58900" palette base0B: "#859900" palette base0C: "#2aa198" palette base0D: "#268bd2" palette base0E: "#6c71c4" palette base0F: "#d33682" end class Monokai < Base16 name 'base16.monokai' dark! # author "Wimer Hazenberg (http://www.monokai.nl)" palette base00: "#272822" palette base01: "#383830" palette base02: "#49483e" palette base03: "#75715e" palette base04: "#a59f85" palette base05: "#f8f8f2" palette base06: "#f5f4f1" palette base07: "#f9f8f5" palette base08: "#f92672" palette base09: "#fd971f" palette base0A: "#f4bf75" palette base0B: "#a6e22e" palette base0C: "#a1efe4" palette base0D: "#66d9ef" palette base0E: "#ae81ff" palette base0F: "#cc6633" end end end end rouge-2.2.1/lib/rouge/themes/monokai.rb0000644000175000017500000000751313150713277017643 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Themes class Monokai < CSSTheme name 'monokai' palette :black => '#000000' palette :bright_green => '#a6e22e' palette :bright_pink => '#f92672' palette :carmine => '#960050' palette :dark => '#49483e' palette :dark_grey => '#888888' palette :dark_red => '#aa0000' palette :dimgrey => '#75715e' palette :dimgreen => '#324932' palette :dimred => '#493131' palette :emperor => '#555555' palette :grey => '#999999' palette :light_grey => '#aaaaaa' palette :light_violet => '#ae81ff' palette :soft_cyan => '#66d9ef' palette :soft_yellow => '#e6db74' palette :very_dark => '#1e0010' palette :whitish => '#f8f8f2' palette :orange => '#f6aa11' palette :white => '#ffffff' style Comment, Comment::Multiline, Comment::Single, :fg => :dimgrey, :italic => true style Comment::Preproc, :fg => :dimgrey, :bold => true style Comment::Special, :fg => :dimgrey, :italic => true, :bold => true style Error, :fg => :carmine, :bg => :very_dark style Generic::Inserted, :fg => :white, :bg => :dimgreen style Generic::Deleted, :fg => :white, :bg => :dimred style Generic::Emph, :fg => :black, :italic => true style Generic::Error, Generic::Traceback, :fg => :dark_red style Generic::Heading, :fg => :grey style Generic::Output, :fg => :dark_grey style Generic::Prompt, :fg => :emperor style Generic::Strong, :bold => true style Generic::Subheading, :fg => :light_grey style Keyword, Keyword::Constant, Keyword::Declaration, Keyword::Pseudo, Keyword::Reserved, Keyword::Type, :fg => :soft_cyan, :bold => true style Keyword::Namespace, Operator::Word, Operator, :fg => :bright_pink, :bold => true style Literal::Number::Float, Literal::Number::Hex, Literal::Number::Integer::Long, Literal::Number::Integer, Literal::Number::Oct, Literal::Number, Literal::String::Escape, :fg => :light_violet style Literal::String::Backtick, Literal::String::Char, Literal::String::Doc, Literal::String::Double, Literal::String::Heredoc, Literal::String::Interpol, Literal::String::Other, Literal::String::Regex, Literal::String::Single, Literal::String::Symbol, Literal::String, :fg => :soft_yellow style Name::Attribute, :fg => :bright_green style Name::Class, Name::Decorator, Name::Exception, Name::Function, :fg => :bright_green, :bold => true style Name::Constant, :fg => :soft_cyan style Name::Builtin::Pseudo, Name::Builtin, Name::Entity, Name::Namespace, Name::Variable::Class, Name::Variable::Global, Name::Variable::Instance, Name::Variable, Text::Whitespace, :fg => :whitish style Name::Label, :fg => :whitish, :bold => true style Name::Tag, :fg => :bright_pink style Text, :fg => :whitish, :bg => :dark end end end rouge-2.2.1/lib/rouge/themes/thankful_eyes.rb0000644000175000017500000000555713150713277021055 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Themes class ThankfulEyes < CSSTheme name 'thankful_eyes' # pallette, from GTKSourceView's ThankfulEyes palette :cool_as_ice => '#6c8b9f' palette :slate_blue => '#4e5d62' palette :eggshell_cloud => '#dee5e7' palette :krasna => '#122b3b' palette :aluminum1 => '#fefeec' palette :scarletred2 => '#cc0000' palette :butter3 => '#c4a000' palette :go_get_it => '#b2fd6d' palette :chilly => '#a8e1fe' palette :unicorn => '#faf6e4' palette :sandy => '#f6dd62' palette :pink_merengue => '#f696db' palette :dune => '#fff0a6' palette :backlit => '#4df4ff' palette :schrill => '#ffb000' style Text, :fg => :unicorn, :bg => :krasna style Generic::Lineno, :fg => :eggshell_cloud, :bg => :slate_blue style Generic::Prompt, :fg => :chilly, :bold => true style Comment, :fg => :cool_as_ice, :italic => true style Comment::Preproc, :fg => :go_get_it, :bold => true, :italic => true style Error, :fg => :aluminum1, :bg => :scarletred2 style Generic::Error, :fg => :scarletred2, :italic => true, :bold => true style Keyword, :fg => :sandy, :bold => true style Operator, :fg => :backlit, :bold => true style Punctuation, :fg => :backlit style Generic::Deleted, :fg => :scarletred2 style Generic::Inserted, :fg => :go_get_it style Generic::Emph, :italic => true style Generic::Strong, :bold => true style Generic::Traceback, :fg => :eggshell_cloud, :bg => :slate_blue style Keyword::Constant, :fg => :pink_merengue, :bold => true style Keyword::Namespace, Keyword::Pseudo, Keyword::Reserved, Generic::Heading, Generic::Subheading, :fg => :schrill, :bold => true style Keyword::Type, Name::Constant, Name::Class, Name::Decorator, Name::Namespace, Name::Builtin::Pseudo, Name::Exception, :fg => :go_get_it, :bold => true style Name::Label, Name::Tag, :fg => :schrill, :bold => true style Literal::Number, Literal::Date, Literal::String::Symbol, :fg => :pink_merengue, :bold => true style Literal::String, :fg => :dune, :bold => true style Literal::String::Escape, Literal::String::Char, Literal::String::Interpol, :fg => :backlit, :bold => true style Name::Builtin, :bold => true style Name::Entity, :fg => '#999999', :bold => true style Text::Whitespace, Generic::Output, :fg => '#BBBBBB' style Name::Function, Name::Property, Name::Attribute, :fg => :chilly style Name::Variable, :fg => :chilly, :bold => true end end end rouge-2.2.1/lib/rouge/themes/gruvbox.rb0000644000175000017500000001023013150713277017670 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # # TODO how are we going to handle soft/hard contrast? module Rouge module Themes # Based on https://github.com/morhetz/gruvbox, with help from # https://github.com/daveyarwood/gruvbox-pygments class Gruvbox < CSSTheme name 'gruvbox' # global Gruvbox colours {{{ C_dark0_hard = '#1d2021' C_dark0 ='#282828' C_dark0_soft = '#32302f' C_dark1 = '#3c3836' C_dark2 = '#504945' C_dark3 = '#665c54' C_dark4 = '#7c6f64' C_dark4_256 = '#7c6f64' C_gray_245 = '#928374' C_gray_244 = '#928374' C_light0_hard = '#f9f5d7' C_light0 = '#fbf1c7' C_light0_soft = '#f2e5bc' C_light1 = '#ebdbb2' C_light2 = '#d5c4a1' C_light3 = '#bdae93' C_light4 = '#a89984' C_light4_256 = '#a89984' C_bright_red = '#fb4934' C_bright_green = '#b8bb26' C_bright_yellow = '#fabd2f' C_bright_blue = '#83a598' C_bright_purple = '#d3869b' C_bright_aqua = '#8ec07c' C_bright_orange = '#fe8019' C_neutral_red = '#cc241d' C_neutral_green = '#98971a' C_neutral_yellow = '#d79921' C_neutral_blue = '#458588' C_neutral_purple = '#b16286' C_neutral_aqua = '#689d6a' C_neutral_orange = '#d65d0e' C_faded_red = '#9d0006' C_faded_green = '#79740e' C_faded_yellow = '#b57614' C_faded_blue = '#076678' C_faded_purple = '#8f3f71' C_faded_aqua = '#427b58' C_faded_orange = '#af3a03' # }}} extend HasModes def self.light! mode :dark # indicate that there is a dark variant mode! :light end def self.dark! mode :light # indicate that there is a light variant mode! :dark end def self.make_dark! palette bg0: C_dark0 palette bg1: C_dark1 palette bg2: C_dark2 palette bg3: C_dark3 palette bg4: C_dark4 palette gray: C_gray_245 palette fg0: C_light0 palette fg1: C_light1 palette fg2: C_light2 palette fg3: C_light3 palette fg4: C_light4 palette fg4_256: C_light4_256 palette red: C_bright_red palette green: C_bright_green palette yellow: C_bright_yellow palette blue: C_bright_blue palette purple: C_bright_purple palette aqua: C_bright_aqua palette orange: C_bright_orange end def self.make_light! palette bg0: C_light0 palette bg1: C_light1 palette bg2: C_light2 palette bg3: C_light3 palette bg4: C_light4 palette gray: C_gray_244 palette fg0: C_dark0 palette fg1: C_dark1 palette fg2: C_dark2 palette fg3: C_dark3 palette fg4: C_dark4 palette fg4_256: C_dark4_256 palette red: C_faded_red palette green: C_faded_green palette yellow: C_faded_yellow palette blue: C_faded_blue palette purple: C_faded_purple palette aqua: C_faded_aqua palette orange: C_faded_orange end dark! mode :light style Text, :fg => :fg0, :bg => :bg0 style Error, :fg => :red, :bg => :bg0, :bold => true style Comment, :fg => :gray, :italic => true style Comment::Preproc, :fg => :aqua style Name::Tag, :fg => :red style Operator, Punctuation, :fg => :fg0 style Generic::Inserted, :fg => :green, :bg => :bg0 style Generic::Deleted, :fg => :red, :bg => :bg0 style Generic::Heading, :fg => :green, :bold => true style Keyword, :fg => :red style Keyword::Constant, :fg => :purple style Keyword::Type, :fg => :yellow style Keyword::Declaration, :fg => :orange style Literal::String, Literal::String::Interpol, Literal::String::Regex, :fg => :green, :italic => true style Literal::String::Escape, :fg => :orange style Name::Namespace, Name::Class, :fg => :aqua style Name::Constant, :fg => :purple style Name::Attribute, :fg => :green style Literal::Number, :fg => :purple style Literal::String::Symbol, :fg => :blue end end end rouge-2.2.1/lib/rouge/themes/monokai_sublime.rb0000644000175000017500000000644513150713277021366 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Themes class MonokaiSublime < CSSTheme name 'monokai.sublime' palette :black => '#000000' palette :bright_green => '#a6e22e' palette :bright_pink => '#f92672' palette :carmine => '#960050' palette :dark => '#49483e' palette :dark_grey => '#888888' palette :dark_red => '#aa0000' palette :dimgrey => '#75715e' palette :emperor => '#555555' palette :grey => '#999999' palette :light_grey => '#aaaaaa' palette :light_violet => '#ae81ff' palette :soft_cyan => '#66d9ef' palette :soft_yellow => '#e6db74' palette :very_dark => '#1e0010' palette :whitish => '#f8f8f2' palette :orange => '#f6aa11' palette :white => '#ffffff' style Generic::Heading, :fg => :grey style Literal::String::Regex, :fg => :orange style Generic::Output, :fg => :dark_grey style Generic::Prompt, :fg => :emperor style Generic::Strong, :bold => false style Generic::Subheading, :fg => :light_grey style Name::Builtin, :fg => :orange style Comment::Multiline, Comment::Preproc, Comment::Single, Comment::Special, Comment, :fg => :dimgrey style Error, Generic::Error, Generic::Traceback, :fg => :carmine style Generic::Deleted, Generic::Inserted, Generic::Emph, :fg => :dark style Keyword::Constant, Keyword::Declaration, Keyword::Reserved, Name::Constant, Keyword::Type, :fg => :soft_cyan style Literal::Number::Float, Literal::Number::Hex, Literal::Number::Integer::Long, Literal::Number::Integer, Literal::Number::Oct, Literal::Number, Literal::String::Char, Literal::String::Escape, Literal::String::Symbol, :fg => :light_violet style Literal::String::Doc, Literal::String::Double, Literal::String::Backtick, Literal::String::Heredoc, Literal::String::Interpol, Literal::String::Other, Literal::String::Single, Literal::String, :fg => :soft_yellow style Name::Attribute, Name::Class, Name::Decorator, Name::Exception, Name::Function, :fg => :bright_green style Name::Variable::Class, Name::Namespace, Name::Label, Name::Entity, Name::Builtin::Pseudo, Name::Variable::Global, Name::Variable::Instance, Name::Variable, Text::Whitespace, Text, Name, :fg => :white style Operator::Word, Name::Tag, Keyword, Keyword::Namespace, Keyword::Pseudo, Operator, :fg => :bright_pink end end end rouge-2.2.1/lib/rouge/cli.rb0000644000175000017500000002350413150713277015466 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # # not required by the main lib. # to use this module, require 'rouge/cli'. module Rouge class FileReader attr_reader :input def initialize(input) @input = input end def file case input when '-' IO.new($stdin.fileno, 'r:utf-8') when String File.new(input, 'r:utf-8') when ->(i){ i.respond_to? :read } input end end def read @read ||= begin file.read rescue => e $stderr.puts "unable to open #{input}: #{e.message}" exit 1 ensure file.close end end end class CLI def self.doc return enum_for(:doc) unless block_given? yield %|usage: rougify [command] [args...]| yield %|| yield %|where is one of:| yield %| highlight #{Highlight.desc}| yield %| help #{Help.desc}| yield %| style #{Style.desc}| yield %| list #{List.desc}| yield %| version #{Version.desc}| yield %|| yield %|See `rougify help ` for more info.| end class Error < StandardError attr_reader :message, :status def initialize(message, status=1) @message = message @status = status end end def self.parse(argv=ARGV) argv = normalize_syntax(argv) mode = argv.shift klass = class_from_arg(mode) return klass.parse(argv) if klass case mode when '-h', '--help', 'help', '-help', nil Help.parse(argv) else argv.unshift(mode) if mode Highlight.parse(argv) end end def initialize(options={}) end def self.error!(msg, status=1) raise Error.new(msg, status) end def error!(*a) self.class.error!(*a) end def self.class_from_arg(arg) case arg when 'version', '--version', '-v' Version when 'help' Help when 'highlight', 'hi' Highlight when 'style' Style when 'list' List end end class Version < CLI def self.desc "print the rouge version number" end def self.parse(*); new; end def run puts Rouge.version end end class Help < CLI def self.desc "print help info" end def self.doc return enum_for(:doc) unless block_given? yield %|usage: rougify help | yield %|| yield %|print help info for .| end def self.parse(argv) opts = { :mode => CLI } until argv.empty? arg = argv.shift klass = class_from_arg(arg) if klass opts[:mode] = klass next end end new(opts) end def initialize(opts={}) @mode = opts[:mode] end def run @mode.doc.each(&method(:puts)) end end class Highlight < CLI def self.desc "highlight code" end def self.doc return enum_for(:doc) unless block_given? yield %[usage: rougify highlight [options...]] yield %[ rougify highlight [options...]] yield %[] yield %[--input-file|-i specify a file to read, or - to use stdin] yield %[] yield %[--lexer|-l specify the lexer to use.] yield %[ If not provided, rougify will try to guess] yield %[ based on --mimetype, the filename, and the] yield %[ file contents.] yield %[] yield %[--formatter|-f specify the output formatter to use.] yield %[ If not provided, rougify will default to] yield %[ terminal256.] yield %[] yield %[--theme|-t specify the theme to use for highlighting] yield %[ the file. (only applies to some formatters)] yield %[] yield %[--mimetype|-m specify a mimetype for lexer guessing] yield %[] yield %[--lexer-opts|-L specify lexer options in CGI format] yield %[ (opt1=val1&opt2=val2)] yield %[] yield %[--formatter-opts|-F specify formatter options in CGI format] yield %[ (opt1=val1&opt2=val2)] yield %[] yield %[--require|-r require a filename or library before] yield %[ highlighting] end def self.parse(argv) opts = { :formatter => 'terminal256', :theme => 'thankful_eyes', :css_class => 'codehilite', :input_file => '-', :lexer_opts => {}, :formatter_opts => {}, :requires => [], } until argv.empty? arg = argv.shift case arg when '-r', '--require' opts[:requires] << argv.shift when '--input-file', '-i' opts[:input_file] = argv.shift when '--mimetype', '-m' opts[:mimetype] = argv.shift when '--lexer', '-l' opts[:lexer] = argv.shift when '--formatter-preset', '-f' opts[:formatter] = argv.shift when '--theme', '-t' opts[:theme] = argv.shift when '--css-class', '-c' opts[:css_class] = argv.shift when '--lexer-opts', '-L' opts[:lexer_opts] = parse_cgi(argv.shift) when /^--/ error! "unknown option #{arg.inspect}" else opts[:input_file] = arg end end new(opts) end def input_stream @input_stream ||= FileReader.new(@input_file) end def input @input ||= input_stream.read end def lexer_class @lexer_class ||= Lexer.guess( :filename => @input_file, :mimetype => @mimetype, :source => input_stream, ) end def lexer @lexer ||= lexer_class.new(@lexer_opts) end attr_reader :input_file, :lexer_name, :mimetype, :formatter def initialize(opts={}) Rouge::Lexer.enable_debug! opts[:requires].each do |r| require r end @input_file = opts[:input_file] if opts[:lexer] @lexer_class = Lexer.find(opts[:lexer]) \ or error! "unknown lexer #{opts[:lexer].inspect}" else @lexer_name = opts[:lexer] @mimetype = opts[:mimetype] end @lexer_opts = opts[:lexer_opts] theme = Theme.find(opts[:theme]).new or error! "unknown theme #{opts[:theme]}" @formatter = case opts[:formatter] when 'terminal256' then Formatters::Terminal256.new(theme) when 'html' then Formatters::HTML.new when 'html-pygments' then Formatters::HTMLPygments.new(Formatters::HTML.new, opts[:css_class]) when 'html-inline' then Formatters::HTMLInline.new(theme) when 'html-table' then Formatters::HTMLTable.new(Formatters::HTML.new) when 'null', 'raw', 'tokens' then Formatters::Null.new else error! "unknown formatter preset #{opts[:formatter]}" end end def run formatter.format(lexer.lex(input), &method(:print)) end private_class_method def self.parse_cgi(str) pairs = CGI.parse(str).map { |k, v| [k.to_sym, v.first] } Hash[pairs] end end class Style < CLI def self.desc "print CSS styles" end def self.doc return enum_for(:doc) unless block_given? yield %|usage: rougify style [] []| yield %|| yield %|Print CSS styles for the given theme. Extra options are| yield %|passed to the theme. Theme defaults to thankful_eyes.| yield %|| yield %|options:| yield %| --scope (default: .highlight) a css selector to scope by| yield %|| yield %|available themes:| yield %| #{Theme.registry.keys.sort.join(', ')}| end def self.parse(argv) opts = { :theme_name => 'thankful_eyes' } until argv.empty? arg = argv.shift case arg when /--(\w+)/ opts[$1.tr('-', '_').to_sym] = argv.shift else opts[:theme_name] = arg end end new(opts) end def initialize(opts) theme_name = opts.delete(:theme_name) theme_class = Theme.find(theme_name) \ or error! "unknown theme: #{theme_name}" @theme = theme_class.new(opts) end def run @theme.render(&method(:puts)) end end class List < CLI def self.desc "list available lexers" end def self.doc return enum_for(:doc) unless block_given? yield %|usage: rouge list| yield %|| yield %|print a list of all available lexers with their descriptions.| end def self.parse(argv) new end def run puts "== Available Lexers ==" Lexer.all.sort_by(&:tag).each do |lexer| desc = "#{lexer.desc}" if lexer.aliases.any? desc << " [aliases: #{lexer.aliases.join(',')}]" end puts "%s: %s" % [lexer.tag, desc] lexer.option_docs.keys.sort.each do |option| puts " ?#{option}= #{lexer.option_docs[option]}" end puts end end end private_class_method def self.normalize_syntax(argv) out = [] argv.each do |arg| case arg when /^(--\w+)=(.*)$/ out << $1 << $2 when /^(-\w)(.+)$/ out << $1 << $2 else out << arg end end out end end end rouge-2.2.1/lib/rouge/version.rb0000644000175000017500000000012113150713277016372 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge def self.version "2.2.1" end end rouge-2.2.1/lib/rouge/formatters/0000755000175000017500000000000013150713277016554 5ustar uwabamiuwabamirouge-2.2.1/lib/rouge/formatters/html_table.rb0000644000175000017500000000340613150713277021217 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Formatters class HTMLTable < Formatter tag 'html_table' def initialize(inner, opts={}) @inner = inner @start_line = opts.fetch(:start_line, 1) @line_format = opts.fetch(:line_format, '%i') @table_class = opts.fetch(:table_class, 'rouge-table') @gutter_class = opts.fetch(:gutter_class, 'rouge-gutter') @code_class = opts.fetch(:code_class, 'rouge-code') end def style(scope) yield "#{scope} .rouge-table { border-spacing: 0 }" yield "#{scope} .rouge-gutter { text-align: right }" end def stream(tokens, &b) num_lines = 0 last_val = '' formatted = '' tokens.each do |tok, val| last_val = val num_lines += val.scan(/\n/).size formatted << @inner.span(tok, val) end # add an extra line for non-newline-terminated strings if last_val[-1] != "\n" num_lines += 1 @inner.span(Token::Tokens::Text::Whitespace, "\n") { |str| formatted << str } end # generate a string of newline-separated line numbers for the gutter> formatted_line_numbers = (@start_line..num_lines+@start_line-1).map do |i| sprintf("#{@line_format}", i) << "\n" end.join('') numbers = %(
#{formatted_line_numbers}
) yield %() # the "gl" class applies the style for Generic.Lineno yield %(' yield %(' yield "
) yield numbers yield '
)
        yield formatted
        yield '
" end end end end rouge-2.2.1/lib/rouge/formatters/html_inline.rb0000644000175000017500000000131213150713277021400 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Formatters class HTMLInline < HTML tag 'html_inline' def initialize(theme) if theme.is_a?(Class) && theme < Rouge::Theme @theme = theme.new elsif theme.is_a?(Rouge::Theme) @theme = theme elsif theme.is_a?(String) @theme = Rouge::Theme.find(theme).new else raise ArgumentError, "invalid theme: #{theme.inspect}" end end def safe_span(tok, safe_val) return safe_val if tok == Token::Tokens::Text rules = @theme.style_for(tok).rendered_rules "#{safe_val}" end end end end rouge-2.2.1/lib/rouge/formatters/html_linewise.rb0000644000175000017500000000115113150713277021742 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Formatters class HTMLLinewise < Formatter def initialize(formatter, opts={}) @formatter = formatter @class_format = opts.fetch(:class, 'line-%i') end def stream(tokens, &b) token_lines(tokens) do |line| yield "
" line.each do |tok, val| yield @formatter.span(tok, val) end yield '
' end end def next_line_class @lineno ||= 0 sprintf(@class_format, @lineno += 1).inspect end end end end rouge-2.2.1/lib/rouge/formatters/html_legacy.rb0000644000175000017500000000254713150713277021401 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # # stdlib require 'cgi' module Rouge module Formatters # Transforms a token stream into HTML output. class HTMLLegacy < Formatter tag 'html_legacy' # @option opts [String] :css_class ('highlight') # @option opts [true/false] :line_numbers (false) # @option opts [Rouge::CSSTheme] :inline_theme (nil) # @option opts [true/false] :wrap (true) # # Initialize with options. # # If `:inline_theme` is given, then instead of rendering the # tokens as tags with CSS classes, the styles according to # the given theme will be inlined in "style" attributes. This is # useful for formats in which stylesheets are not available. # # Content will be wrapped in a tag (`div` if tableized, `pre` if # not) with the given `:css_class` unless `:wrap` is set to `false`. def initialize(opts={}) @formatter = opts[:inline_theme] ? HTMLInline.new(opts[:inline_theme]) : HTML.new @formatter = HTMLTable.new(@formatter, opts) if opts[:line_numbers] if opts.fetch(:wrap, true) @formatter = HTMLPygments.new(@formatter, opts.fetch(:css_class, 'codehilite')) end end # @yield the html output. def stream(tokens, &b) @formatter.stream(tokens, &b) end end end end rouge-2.2.1/lib/rouge/formatters/html_pygments.rb0000644000175000017500000000060213150713277021771 0ustar uwabamiuwabamimodule Rouge module Formatters class HTMLPygments < Formatter def initialize(inner, css_class='codehilite') @inner = inner @css_class = css_class end def stream(tokens, &b) yield %(
)
        @inner.stream(tokens, &b)
        yield "
" end end end end rouge-2.2.1/lib/rouge/formatters/terminal256.rb0000644000175000017500000001151613150713277021155 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Formatters # A formatter for 256-color terminals class Terminal256 < Formatter tag 'terminal256' # @private attr_reader :theme # @param [Hash,Rouge::Theme] theme # the theme to render with. def initialize(theme = Themes::ThankfulEyes.new) if theme.is_a?(Rouge::Theme) @theme = theme elsif theme.is_a?(Hash) @theme = theme[:theme] || Themes::ThankfulEyes.new else raise ArgumentError, "invalid theme: #{theme.inspect}" end end def stream(tokens, &b) tokens.each do |tok, val| escape = escape_sequence(tok) yield escape.style_string yield val.gsub("\n", "#{escape.reset_string}\n#{escape.style_string}") yield escape.reset_string end end class EscapeSequence attr_reader :style def initialize(style) @style = style end def self.xterm_colors @xterm_colors ||= [].tap do |out| # colors 0..15: 16 basic colors out << [0x00, 0x00, 0x00] # 0 out << [0xcd, 0x00, 0x00] # 1 out << [0x00, 0xcd, 0x00] # 2 out << [0xcd, 0xcd, 0x00] # 3 out << [0x00, 0x00, 0xee] # 4 out << [0xcd, 0x00, 0xcd] # 5 out << [0x00, 0xcd, 0xcd] # 6 out << [0xe5, 0xe5, 0xe5] # 7 out << [0x7f, 0x7f, 0x7f] # 8 out << [0xff, 0x00, 0x00] # 9 out << [0x00, 0xff, 0x00] # 10 out << [0xff, 0xff, 0x00] # 11 out << [0x5c, 0x5c, 0xff] # 12 out << [0xff, 0x00, 0xff] # 13 out << [0x00, 0xff, 0xff] # 14 out << [0xff, 0xff, 0xff] # 15 # colors 16..232: the 6x6x6 color cube valuerange = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff] 217.times do |i| r = valuerange[(i / 36) % 6] g = valuerange[(i / 6) % 6] b = valuerange[i % 6] out << [r, g, b] end # colors 233..253: grayscale 1.upto 22 do |i| v = 8 + i * 10 out << [v, v, v] end end end def fg return @fg if instance_variable_defined? :@fg @fg = style.fg && self.class.color_index(style.fg) end def bg return @bg if instance_variable_defined? :@bg @bg = style.bg && self.class.color_index(style.bg) end def style_string @style_string ||= begin attrs = [] attrs << ['38', '5', fg.to_s] if fg attrs << ['48', '5', bg.to_s] if bg attrs << '01' if style[:bold] attrs << '04' if style[:italic] # underline, but hey, whatevs escape(attrs) end end def reset_string @reset_string ||= begin attrs = [] attrs << '39' if fg # fg reset attrs << '49' if bg # bg reset attrs << '00' if style[:bold] || style[:italic] escape(attrs) end end private def escape(attrs) return '' if attrs.empty? "\e[#{attrs.join(';')}m" end def self.color_index(color) @color_index_cache ||= {} @color_index_cache[color] ||= closest_color(*get_rgb(color)) end def self.get_rgb(color) color = $1 if color =~ /#([0-9a-f]+)/i hexes = case color.size when 3 color.chars.map { |c| "#{c}#{c}" } when 6 color.scan(/../) else raise "invalid color: #{color}" end hexes.map { |h| h.to_i(16) } end # max distance between two colors, #000000 to #ffffff MAX_DISTANCE = 257 * 257 * 3 def self.closest_color(r, g, b) @@colors_cache ||= {} key = (r << 16) + (g << 8) + b @@colors_cache.fetch(key) do distance = MAX_DISTANCE match = 0 xterm_colors.each_with_index do |(cr, cg, cb), i| d = (r - cr)**2 + (g - cg)**2 + (b - cb)**2 next if d >= distance match = i distance = d end match end end end # private def escape_sequence(token) @escape_sequences ||= {} @escape_sequences[token.qualname] ||= EscapeSequence.new(get_style(token)) end def get_style(token) return text_style if token.ancestors.include? Token::Tokens::Text theme.get_own_style(token) || text_style end def text_style style = theme.get_style(Token['Text']) # don't highlight text backgrounds style.delete :bg style end end end end rouge-2.2.1/lib/rouge/formatters/null.rb0000644000175000017500000000051713150713277020056 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Formatters # A formatter which renders nothing. class Null < Formatter tag 'null' def initialize(*) end def stream(tokens, &b) tokens.each do |tok, val| yield "#{tok.qualname} #{val.inspect}\n" end end end end end rouge-2.2.1/lib/rouge/formatters/html.rb0000644000175000017500000000146113150713277020047 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Formatters # Transforms a token stream into HTML output. class HTML < Formatter tag 'html' # @yield the html output. def stream(tokens, &b) tokens.each { |tok, val| yield span(tok, val) } end def span(tok, val) safe_span(tok, val.gsub(/[&<>]/, TABLE_FOR_ESCAPE_HTML)) end def safe_span(tok, safe_val) if tok == Token::Tokens::Text safe_val else shortname = tok.shortname \ or raise "unknown token: #{tok.inspect} for #{safe_val.inspect}" "#{safe_val}" end end TABLE_FOR_ESCAPE_HTML = { '&' => '&', '<' => '<', '>' => '>', } end end end rouge-2.2.1/lib/rouge/plugins/0000755000175000017500000000000013150713277016047 5ustar uwabamiuwabamirouge-2.2.1/lib/rouge/plugins/redcarpet.rb0000644000175000017500000000151713150713277020351 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # # this file is not require'd from the root. To use this plugin, run: # # require 'rouge/plugins/redcarpet' module Rouge module Plugins module Redcarpet def block_code(code, language) lexer = Lexer.find_fancy(language, code) || Lexers::PlainText # XXX HACK: Redcarpet strips hard tabs out of code blocks, # so we assume you're not using leading spaces that aren't tabs, # and just replace them here. if lexer.tag == 'make' code.gsub! /^ /, "\t" end formatter = rouge_formatter(lexer) formatter.format(lexer.lex(code)) end # override this method for custom formatting behavior def rouge_formatter(lexer) Formatters::HTMLLegacy.new(:css_class => "highlight #{lexer.tag}") end end end end rouge-2.2.1/lib/rouge/template_lexer.rb0000644000175000017500000000114113150713277017722 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge # @abstract # A TemplateLexer is one that accepts a :parent option, to specify # which language is being templated. The lexer class can specify its # own default for the parent lexer, which is otherwise defaulted to # HTML. class TemplateLexer < RegexLexer # the parent lexer - the one being templated. def parent return @parent if instance_variable_defined? :@parent @parent = lexer_option(:parent) || Lexers::HTML.new(@options) end option :parent, "the parent language (default: html)" start { parent.reset! } end end rouge-2.2.1/lib/rouge/lexers/0000755000175000017500000000000013150713277015670 5ustar uwabamiuwabamirouge-2.2.1/lib/rouge/lexers/diff.rb0000644000175000017500000000153313150713277017127 0ustar uwabamiuwabamimodule Rouge module Lexers class Diff < RegexLexer title 'diff' desc 'Lexes unified diffs or patches' tag 'diff' aliases 'patch', 'udiff' filenames '*.diff', '*.patch' mimetypes 'text/x-diff', 'text/x-patch' def self.analyze_text(text) return 1 if text.start_with?('Index: ') return 1 if text.start_with?('diff ') return 0.9 if text.start_with?('--- ') end state :root do rule(/^ .*$\n?/, Text) rule(/^---$\n?/, Text) rule(/^\+.*$\n?/, Generic::Inserted) rule(/^-+.*$\n?/, Generic::Deleted) rule(/^!.*$\n?/, Generic::Strong) rule(/^@.*$\n?/, Generic::Subheading) rule(/^([Ii]ndex|diff).*$\n?/, Generic::Heading) rule(/^=.*$\n?/, Generic::Heading) rule(/.*$\n?/, Text) end end end end rouge-2.2.1/lib/rouge/lexers/tap.rb0000644000175000017500000000402713150713277017004 0ustar uwabamiuwabamimodule Rouge module Lexers class Tap < RegexLexer title 'TAP' desc 'Test Anything Protocol' tag 'tap' aliases 'tap' filenames '*.tap' mimetypes 'text/x-tap', 'application/x-tap' def self.analyze_text(text) return 0 end state :root do # A TAP version may be specified. rule /^TAP version \d+\n/, Name::Namespace # Specify a plan with a plan line. rule /^1\.\.\d+/, Keyword::Declaration, :plan # A test failure rule /^(not ok)([^\S\n]*)(\d*)/ do groups Generic::Error, Text, Literal::Number::Integer push :test end # A test success rule /^(ok)([^\S\n]*)(\d*)/ do groups Keyword::Reserved, Text, Literal::Number::Integer push :test end # Diagnostics start with a hash. rule /^#.*\n/, Comment # TAP's version of an abort statement. rule /^Bail out!.*\n/, Generic::Error # # TAP ignores any unrecognized lines. rule /^.*\n/, Text end state :plan do # Consume whitespace (but not newline). rule /[^\S\n]+/, Text # A plan may have a directive with it. rule /#/, Comment, :directive # Or it could just end. rule /\n/, Comment, :pop! # Anything else is wrong. rule /.*\n/, Generic::Error, :pop! end state :test do # Consume whitespace (but not newline). rule /[^\S\n]+/, Text # A test may have a directive with it. rule /#/, Comment, :directive rule /\S+/, Text rule /\n/, Text, :pop! end state :directive do # Consume whitespace (but not newline). rule /[^\S\n]+/, Comment # Extract todo items. rule /(?i)\bTODO\b/, Comment::Preproc # Extract skip items. rule /(?i)\bSKIP\S*/, Comment::Preproc rule /\S+/, Comment rule /\n/ do token Comment pop! 2 end end end end end rouge-2.2.1/lib/rouge/lexers/racket.rb0000644000175000017500000007150113150713277017472 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Racket < RegexLexer title "Racket" desc "Racket is a Lisp descended from Scheme (racket-lang.org)" tag 'racket' filenames '*.rkt', '*.rktd', '*.rktl' mimetypes 'text/x-racket', 'application/x-racket' def self.analyze_text(text) text = text.strip return 1 if text.start_with? '#lang racket' return 0.6 if text =~ %r(\A#lang [a-z/-]+$)i end def self.keywords @keywords ||= Set.new %w( ... and begin begin-for-syntax begin0 case case-lambda cond datum->syntax-object define define-for-syntax define-logger define-struct define-syntax define-syntax-rule define-syntaxes define-values define-values-for-syntax delay do expand-path fluid-let force hash-table-copy hash-table-count hash-table-for-each hash-table-get hash-table-iterate-first hash-table-iterate-key hash-table-iterate-next hash-table-iterate-value hash-table-map hash-table-put! hash-table-remove! hash-table? if lambda let let* let*-values let-struct let-syntax let-syntaxes let-values let/cc let/ec letrec letrec-syntax letrec-syntaxes letrec-syntaxes+values letrec-values list-immutable make-hash-table make-immutable-hash-table make-namespace module module* module-identifier=? module-label-identifier=? module-template-identifier=? module-transformer-identifier=? namespace-transformer-require or parameterize parameterize* parameterize-break promise? prop:method-arity-error provide provide-for-label provide-for-syntax quasiquote quasisyntax quasisyntax/loc quote quote-syntax quote-syntax/prune require require-for-label require-for-syntax require-for-template set! set!-values syntax syntax-case syntax-case* syntax-id-rules syntax-object->datum syntax-rules syntax/loc tcp-abandon-port tcp-accept tcp-accept-evt tcp-accept-ready? tcp-accept/enable-break tcp-addresses tcp-close tcp-connect tcp-connect/enable-break tcp-listen tcp-listener? tcp-port? time transcript-off transcript-on udp-addresses udp-bind! udp-bound? udp-close udp-connect! udp-connected? udp-multicast-interface udp-multicast-join-group! udp-multicast-leave-group! udp-multicast-loopback? udp-multicast-set-interface! udp-multicast-set-loopback! udp-multicast-set-ttl! udp-multicast-ttl udp-open-socket udp-receive! udp-receive!* udp-receive!-evt udp-receive!/enable-break udp-receive-ready-evt udp-send udp-send* udp-send-evt udp-send-ready-evt udp-send-to udp-send-to* udp-send-to-evt udp-send-to/enable-break udp-send/enable-break udp? unless unquote unquote-splicing unsyntax unsyntax-splicing when with-continuation-mark with-handlers with-handlers* with-syntax λ) end def self.builtins @builtins ||= Set.new %w( * + - / < <= = > >= abort-current-continuation abs absolute-path? acos add1 alarm-evt always-evt andmap angle append apply arithmetic-shift arity-at-least arity-at-least-value arity-at-least? asin assoc assq assv atan banner bitwise-and bitwise-bit-field bitwise-bit-set? bitwise-ior bitwise-not bitwise-xor boolean? bound-identifier=? box box-cas! box-immutable box? break-enabled break-thread build-path build-path/convention-type byte-pregexp byte-pregexp? byte-ready? byte-regexp byte-regexp? byte? bytes bytes->immutable-bytes bytes->list bytes->path bytes->path-element bytes->string/latin-1 bytes->string/locale bytes->string/utf-8 bytes-append bytes-close-converter bytes-convert bytes-convert-end bytes-converter? bytes-copy bytes-copy! bytes-environment-variable-name? bytes-fill! bytes-length bytes-open-converter bytes-ref bytes-set! bytes-utf-8-index bytes-utf-8-length bytes-utf-8-ref bytes? bytes? caaaar caaadr caaar caadar caaddr caadr caar cadaar cadadr cadar caddar cadddr caddr cadr call-in-nested-thread call-with-break-parameterization call-with-composable-continuation call-with-continuation-barrier call-with-continuation-prompt call-with-current-continuation call-with-default-reading-parameterization call-with-escape-continuation call-with-exception-handler call-with-immediate-continuation-mark call-with-input-file call-with-output-file call-with-parameterization call-with-semaphore call-with-semaphore/enable-break call-with-values call/cc call/ec car cdaaar cdaadr cdaar cdadar cdaddr cdadr cdar cddaar cddadr cddar cdddar cddddr cdddr cddr cdr ceiling channel-get channel-put channel-put-evt channel-put-evt? channel-try-get channel? chaperone-box chaperone-continuation-mark-key chaperone-evt chaperone-hash chaperone-of? chaperone-procedure chaperone-prompt-tag chaperone-struct chaperone-struct-type chaperone-vector chaperone? char->integer char-alphabetic? char-blank? char-ci<=? char-ci=? char-ci>? char-downcase char-foldcase char-general-category char-graphic? char-iso-control? char-lower-case? char-numeric? char-punctuation? char-ready? char-symbolic? char-title-case? char-titlecase char-upcase char-upper-case? char-utf-8-length char-whitespace? char<=? char=? char>? char? check-duplicate-identifier checked-procedure-check-and-extract choice-evt cleanse-path close-input-port close-output-port collect-garbage collection-file-path collection-path compile compile-allow-set!-undefined compile-context-preservation-enabled compile-enforce-module-constants compile-syntax compiled-expression? compiled-module-expression? complete-path? complex? cons continuation-mark-key? continuation-mark-set->context continuation-mark-set->list continuation-mark-set->list* continuation-mark-set-first continuation-mark-set? continuation-marks continuation-prompt-available? continuation-prompt-tag? continuation? copy-file cos current-break-parameterization current-code-inspector current-command-line-arguments current-compile current-compiled-file-roots current-continuation-marks current-custodian current-directory current-directory-for-user current-drive current-environment-variables current-error-port current-eval current-evt-pseudo-random-generator current-gc-milliseconds current-get-interaction-input-port current-inexact-milliseconds current-input-port current-inspector current-library-collection-paths current-load current-load-extension current-load-relative-directory current-load/use-compiled current-locale current-memory-use current-milliseconds current-module-declare-name current-module-declare-source current-module-name-resolver current-module-path-for-load current-namespace current-output-port current-parameterization current-preserved-thread-cell-values current-print current-process-milliseconds current-prompt-read current-pseudo-random-generator current-read-interaction current-reader-guard current-readtable current-seconds current-security-guard current-subprocess-custodian-mode current-thread current-thread-group current-thread-initial-stack-size current-write-relative-directory custodian-box-value custodian-box? custodian-limit-memory custodian-managed-list custodian-memory-accounting-available? custodian-require-memory custodian-shutdown-all custodian? custom-print-quotable-accessor custom-print-quotable? custom-write-accessor custom-write? date date* date*-nanosecond date*-time-zone-name date*? date-day date-dst? date-hour date-minute date-month date-second date-time-zone-offset date-week-day date-year date-year-day date? datum-intern-literal default-continuation-prompt-tag delete-directory delete-file denominator directory-exists? directory-list display displayln dump-memory-stats dynamic-require dynamic-require-for-syntax dynamic-wind environment-variables-copy environment-variables-names environment-variables-ref environment-variables-set! environment-variables? eof eof-object? ephemeron-value ephemeron? eprintf eq-hash-code eq? equal-hash-code equal-secondary-hash-code equal? equal?/recur eqv-hash-code eqv? error error-display-handler error-escape-handler error-print-context-length error-print-source-location error-print-width error-value->string-handler eval eval-jit-enabled eval-syntax even? evt? exact->inexact exact-integer? exact-nonnegative-integer? exact-positive-integer? exact? executable-yield-handler exit exit-handler exn exn-continuation-marks exn-message exn:break exn:break-continuation exn:break:hang-up exn:break:hang-up? exn:break:terminate exn:break:terminate? exn:break? exn:fail exn:fail:contract exn:fail:contract:arity exn:fail:contract:arity? exn:fail:contract:continuation exn:fail:contract:continuation? exn:fail:contract:divide-by-zero exn:fail:contract:divide-by-zero? exn:fail:contract:non-fixnum-result exn:fail:contract:non-fixnum-result? exn:fail:contract:variable exn:fail:contract:variable-id exn:fail:contract:variable? exn:fail:contract? exn:fail:filesystem exn:fail:filesystem:errno exn:fail:filesystem:errno-errno exn:fail:filesystem:errno? exn:fail:filesystem:exists exn:fail:filesystem:exists? exn:fail:filesystem:missing-module exn:fail:filesystem:missing-module-path exn:fail:filesystem:missing-module? exn:fail:filesystem:version exn:fail:filesystem:version? exn:fail:filesystem? exn:fail:network exn:fail:network:errno exn:fail:network:errno-errno exn:fail:network:errno? exn:fail:network? exn:fail:out-of-memory exn:fail:out-of-memory? exn:fail:read exn:fail:read-srclocs exn:fail:read:eof exn:fail:read:eof? exn:fail:read:non-char exn:fail:read:non-char? exn:fail:read? exn:fail:syntax exn:fail:syntax-exprs exn:fail:syntax:missing-module exn:fail:syntax:missing-module-path exn:fail:syntax:missing-module? exn:fail:syntax:unbound exn:fail:syntax:unbound? exn:fail:syntax? exn:fail:unsupported exn:fail:unsupported? exn:fail:user exn:fail:user? exn:fail? exn:missing-module-accessor exn:missing-module? exn:srclocs-accessor exn:srclocs? exn? exp expand expand-once expand-syntax expand-syntax-once expand-syntax-to-top-form expand-to-top-form expand-user-path explode-path expt file-exists? file-or-directory-identity file-or-directory-modify-seconds file-or-directory-permissions file-position file-position* file-size file-stream-buffer-mode file-stream-port? file-truncate filesystem-change-evt filesystem-change-evt-cancel filesystem-change-evt? filesystem-root-list find-executable-path find-library-collection-paths find-system-path fixnum? floating-point-bytes->real flonum? floor flush-output for-each format fprintf free-identifier=? gcd generate-temporaries gensym get-output-bytes get-output-string getenv global-port-print-handler guard-evt handle-evt handle-evt? hash hash-equal? hash-eqv? hash-has-key? hash-placeholder? hash-ref! hasheq hasheqv identifier-binding identifier-binding-symbol identifier-label-binding identifier-prune-lexical-context identifier-prune-to-source-module identifier-remove-from-definition-context identifier-template-binding identifier-transformer-binding identifier? imag-part immutable? impersonate-box impersonate-continuation-mark-key impersonate-hash impersonate-procedure impersonate-prompt-tag impersonate-struct impersonate-vector impersonator-ephemeron impersonator-of? impersonator-prop:application-mark impersonator-property-accessor-procedure? impersonator-property? impersonator? inexact->exact inexact-real? inexact? input-port? inspector? integer->char integer->integer-bytes integer-bytes->integer integer-length integer-sqrt integer-sqrt/remainder integer? internal-definition-context-seal internal-definition-context? keyword->string keywordbytes list->string list->vector list-ref list-tail list? load load-extension load-on-demand-enabled load-relative load-relative-extension load/cd load/use-compiled local-expand local-expand/capture-lifts local-transformer-expand local-transformer-expand/capture-lifts locale-string-encoding log log-max-level magnitude make-arity-at-least make-bytes make-channel make-continuation-mark-key make-continuation-prompt-tag make-custodian make-custodian-box make-date make-date* make-derived-parameter make-directory make-environment-variables make-ephemeron make-exn make-exn:break make-exn:break:hang-up make-exn:break:terminate make-exn:fail make-exn:fail:contract make-exn:fail:contract:arity make-exn:fail:contract:continuation make-exn:fail:contract:divide-by-zero make-exn:fail:contract:non-fixnum-result make-exn:fail:contract:variable make-exn:fail:filesystem make-exn:fail:filesystem:errno make-exn:fail:filesystem:exists make-exn:fail:filesystem:missing-module make-exn:fail:filesystem:version make-exn:fail:network make-exn:fail:network:errno make-exn:fail:out-of-memory make-exn:fail:read make-exn:fail:read:eof make-exn:fail:read:non-char make-exn:fail:syntax make-exn:fail:syntax:missing-module make-exn:fail:syntax:unbound make-exn:fail:unsupported make-exn:fail:user make-file-or-directory-link make-hash-placeholder make-hasheq-placeholder make-hasheqv make-hasheqv-placeholder make-immutable-hasheqv make-impersonator-property make-input-port make-inspector make-known-char-range-list make-output-port make-parameter make-phantom-bytes make-pipe make-placeholder make-polar make-prefab-struct make-pseudo-random-generator make-reader-graph make-readtable make-rectangular make-rename-transformer make-resolved-module-path make-security-guard make-semaphore make-set!-transformer make-shared-bytes make-sibling-inspector make-special-comment make-srcloc make-string make-struct-field-accessor make-struct-field-mutator make-struct-type make-struct-type-property make-syntax-delta-introducer make-syntax-introducer make-thread-cell make-thread-group make-vector make-weak-box make-weak-hasheqv make-will-executor map max mcar mcdr mcons member memq memv min module->exports module->imports module->language-info module->namespace module-compiled-cross-phase-persistent? module-compiled-exports module-compiled-imports module-compiled-language-info module-compiled-name module-compiled-submodules module-declared? module-path-index-join module-path-index-resolve module-path-index-split module-path-index-submodule module-path-index? module-path? module-predefined? module-provide-protected? modulo mpair? nack-guard-evt namespace-attach-module namespace-attach-module-declaration namespace-base-phase namespace-mapped-symbols namespace-module-identifier namespace-module-registry namespace-require namespace-require/constant namespace-require/copy namespace-require/expansion-time namespace-set-variable-value! namespace-symbol->identifier namespace-syntax-introduce namespace-undefine-variable! namespace-unprotect-module namespace-variable-value namespace? negative? never-evt newline normal-case-path not null null? number->string number? numerator object-name odd? open-input-bytes open-input-file open-input-output-file open-input-string open-output-bytes open-output-file open-output-string ormap output-port? pair? parameter-procedure=? parameter? parameterization? path->bytes path->complete-path path->directory-path path->string path-add-suffix path-convention-type path-element->bytes path-element->string path-for-some-system? path-list-string->path-list path-replace-suffix path-string? path? peek-byte peek-byte-or-special peek-bytes peek-bytes! peek-bytes-avail! peek-bytes-avail!* peek-bytes-avail!/enable-break peek-char peek-char-or-special peek-string peek-string! phantom-bytes? pipe-content-length placeholder-get placeholder-set! placeholder? poll-guard-evt port-closed-evt port-closed? port-commit-peeked port-count-lines! port-count-lines-enabled port-counts-lines? port-display-handler port-file-identity port-file-unlock port-next-location port-print-handler port-progress-evt port-provides-progress-evts? port-read-handler port-try-file-lock? port-write-handler port-writes-atomic? port-writes-special? port? positive? prefab-key->struct-type prefab-key? prefab-struct-key pregexp pregexp? primitive-closure? primitive-result-arity primitive? print print-as-expression print-boolean-long-form print-box print-graph print-hash-table print-mpair-curly-braces print-pair-curly-braces print-reader-abbreviations print-struct print-syntax-width print-unreadable print-vector-length printf procedure->method procedure-arity procedure-arity-includes? procedure-arity? procedure-closure-contents-eq? procedure-extract-target procedure-reduce-arity procedure-rename procedure-struct-type? procedure? progress-evt? prop:arity-string prop:checked-procedure prop:custom-print-quotable prop:custom-write prop:equal+hash prop:evt prop:exn:missing-module prop:exn:srclocs prop:impersonator-of prop:input-port prop:liberal-define-context prop:output-port prop:procedure prop:rename-transformer prop:set!-transformer pseudo-random-generator->vector pseudo-random-generator-vector? pseudo-random-generator? putenv quotient quotient/remainder raise raise-argument-error raise-arguments-error raise-arity-error raise-mismatch-error raise-range-error raise-result-error raise-syntax-error raise-type-error raise-user-error random random-seed rational? rationalize read read-accept-bar-quote read-accept-box read-accept-compiled read-accept-dot read-accept-graph read-accept-infix-dot read-accept-lang read-accept-quasiquote read-accept-reader read-byte read-byte-or-special read-bytes read-bytes! read-bytes-avail! read-bytes-avail!* read-bytes-avail!/enable-break read-bytes-line read-case-sensitive read-char read-char-or-special read-curly-brace-as-paren read-decimal-as-inexact read-eval-print-loop read-language read-line read-on-demand-source read-square-bracket-as-paren read-string read-string! read-syntax read-syntax/recursive read/recursive readtable-mapping readtable? real->double-flonum real->floating-point-bytes real->single-flonum real-part real? regexp regexp-match regexp-match-peek regexp-match-peek-immediate regexp-match-peek-positions regexp-match-peek-positions-immediate regexp-match-peek-positions-immediate/end regexp-match-peek-positions/end regexp-match-positions regexp-match-positions/end regexp-match/end regexp-match? regexp-max-lookbehind regexp-replace regexp-replace* regexp? relative-path? remainder rename-file-or-directory rename-transformer-target rename-transformer? reroot-path resolve-path resolved-module-path-name resolved-module-path? reverse round seconds->date security-guard? semaphore-peek-evt semaphore-peek-evt? semaphore-post semaphore-try-wait? semaphore-wait semaphore-wait/enable-break semaphore? set!-transformer-procedure set!-transformer? set-box! set-mcar! set-mcdr! set-phantom-bytes! set-port-next-location! shared-bytes shell-execute simplify-path sin single-flonum? sleep special-comment-value special-comment? split-path sqrt srcloc srcloc->string srcloc-column srcloc-line srcloc-position srcloc-source srcloc-span srcloc? string string->bytes/latin-1 string->bytes/locale string->bytes/utf-8 string->immutable-string string->keyword string->list string->number string->path string->path-element string->symbol string->uninterned-symbol string->unreadable-symbol string-append string-ci<=? string-ci=? string-ci>? string-copy string-copy! string-downcase string-environment-variable-name? string-fill! string-foldcase string-length string-locale-ci? string-locale-downcase string-locale-upcase string-locale? string-normalize-nfc string-normalize-nfd string-normalize-nfkc string-normalize-nfkd string-ref string-set! string-titlecase string-upcase string-utf-8-length string<=? string=? string>? string? struct->vector struct-accessor-procedure? struct-constructor-procedure? struct-info struct-mutator-procedure? struct-predicate-procedure? struct-type-info struct-type-make-constructor struct-type-make-predicate struct-type-property-accessor-procedure? struct-type-property? struct-type? struct:arity-at-least struct:date struct:date* struct:exn struct:exn:break struct:exn:break:hang-up struct:exn:break:terminate struct:exn:fail struct:exn:fail:contract struct:exn:fail:contract:arity struct:exn:fail:contract:continuation struct:exn:fail:contract:divide-by-zero struct:exn:fail:contract:non-fixnum-result struct:exn:fail:contract:variable struct:exn:fail:filesystem struct:exn:fail:filesystem:errno struct:exn:fail:filesystem:exists struct:exn:fail:filesystem:missing-module struct:exn:fail:filesystem:version struct:exn:fail:network struct:exn:fail:network:errno struct:exn:fail:out-of-memory struct:exn:fail:read struct:exn:fail:read:eof struct:exn:fail:read:non-char struct:exn:fail:syntax struct:exn:fail:syntax:missing-module struct:exn:fail:syntax:unbound struct:exn:fail:unsupported struct:exn:fail:user struct:srcloc struct? sub1 subbytes subprocess subprocess-group-enabled subprocess-kill subprocess-pid subprocess-status subprocess-wait subprocess? substring symbol->string symbol-interned? symbol-unreadable? symbol? sync sync/enable-break sync/timeout sync/timeout/enable-break syntax->list syntax-arm syntax-column syntax-disarm syntax-e syntax-line syntax-local-bind-syntaxes syntax-local-certifier syntax-local-context syntax-local-expand-expression syntax-local-get-shadower syntax-local-introduce syntax-local-lift-context syntax-local-lift-expression syntax-local-lift-module-end-declaration syntax-local-lift-provide syntax-local-lift-require syntax-local-lift-values-expression syntax-local-make-definition-context syntax-local-make-delta-introducer syntax-local-module-defined-identifiers syntax-local-module-exports syntax-local-module-required-identifiers syntax-local-name syntax-local-phase-level syntax-local-submodules syntax-local-transforming-module-provides? syntax-local-value syntax-local-value/immediate syntax-original? syntax-position syntax-property syntax-property-symbol-keys syntax-protect syntax-rearm syntax-recertify syntax-shift-phase-level syntax-source syntax-source-module syntax-span syntax-taint syntax-tainted? syntax-track-origin syntax-transforming-module-expression? syntax-transforming? syntax? system-big-endian? system-idle-evt system-language+country system-library-subpath system-path-convention-type system-type tan terminal-port? thread thread-cell-ref thread-cell-set! thread-cell-values? thread-cell? thread-dead-evt thread-dead? thread-group? thread-resume thread-resume-evt thread-rewind-receive thread-running? thread-suspend thread-suspend-evt thread-wait thread/suspend-to-kill thread? time-apply truncate unbox uncaught-exception-handler use-collection-link-paths use-compiled-file-paths use-user-specific-search-paths values variable-reference->empty-namespace variable-reference->module-base-phase variable-reference->module-declaration-inspector variable-reference->module-path-index variable-reference->module-source variable-reference->namespace variable-reference->phase variable-reference->resolved-module-path variable-reference-constant? variable-reference? vector vector->immutable-vector vector->list vector->pseudo-random-generator vector->pseudo-random-generator! vector->values vector-fill! vector-immutable vector-length vector-ref vector-set! vector-set-performance-stats! vector? version void void? weak-box-value weak-box? will-execute will-executor? will-register will-try-execute with-input-from-file with-output-to-file wrap-evt write write-byte write-bytes write-bytes-avail write-bytes-avail* write-bytes-avail-evt write-bytes-avail/enable-break write-char write-special write-special-avail* write-special-evt write-string zero? ) end # Since Racket allows identifiers to consist of nearly anything, # it's simpler to describe what an ID is _not_. id = /[^\s\(\)\[\]\{\}'`,.]+/i state :root do # comments rule /;.*$/, Comment::Single rule /\s+/m, Text rule /[+-]inf[.][f0]/, Num::Float rule /[+-]nan[.]0/, Num::Float rule /[-]min[.]0/, Num::Float rule /[+]max[.]0/, Num::Float rule /-?\d+\.\d+/, Num::Float rule /-?\d+/, Num::Integer rule /#:#{id}+/, Name::Tag # keyword rule /#b[01]+/, Num::Bin rule /#o[0-7]+/, Num::Oct rule /#d[0-9]+/, Num::Integer rule /#x[0-9a-f]+/i, Num::Hex rule /#[ei][\d.]+/, Num::Other rule /"(\\\\|\\"|[^"])*"/, Str rule /['`]#{id}/i, Str::Symbol rule /#\\([()\/'"._!\$%& ?=+-]{1}|[a-z0-9]+)/i, Str::Char rule /#t|#f/, Name::Constant rule /(?:'|#|`|,@|,|\.)/, Operator rule /(['#])(\s*)(\()/m do groups Str::Symbol, Text, Punctuation end # () [] {} are all permitted as like pairs rule /\(|\[|\{/, Punctuation, :command rule /\)|\]|\}/, Punctuation rule id, Name::Variable end state :command do rule id, Name::Function do |m| if self.class.keywords.include? m[0] token Keyword elsif self.class.builtins.include? m[0] token Name::Builtin else token Name::Function end pop! end rule(//) { pop! } end end end end rouge-2.2.1/lib/rouge/lexers/groovy.rb0000644000175000017500000000623413150713277017547 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Groovy < RegexLexer title "Groovy" desc 'The Groovy programming language (http://www.groovy-lang.org/)' tag 'groovy' filenames '*.groovy', 'Jenkinsfile' mimetypes 'text/x-groovy' ws = %r((?:\s|//.*?\n|/[*].*?[*]/)+) def self.analyze_text(text) return 1 if text.shebang?(/groovy/) end def self.keywords @keywords ||= Set.new %w( assert break case catch continue default do else finally for if goto instanceof new return switch this throw try while in as ) end def self.declarations @declarations ||= Set.new %w( abstract const enum extends final implements native private protected public static strictfp super synchronized throws transient volatile ) end def self.types @types ||= Set.new %w( def boolean byte char double float int long short void ) end def self.constants @constants ||= Set.new %w(true false null) end state :root do rule %r(^ (\s*(?:\w[\w\d.\[\]]*\s+)+?) # return arguments (\w[\w\d]*) # method name (\s*) (\() # signature start )x do |m| delegate self.clone, m[1] token Name::Function, m[2] token Text, m[3] token Operator, m[4] end # whitespace rule /[^\S\n]+/, Text rule %r(//.*?$), Comment::Single rule %r(/[*].*?[*]/)m, Comment::Multiline rule /@\w[\w\d.]*/, Name::Decorator rule /(class|interface|trait)\b/, Keyword::Declaration, :class rule /package\b/, Keyword::Namespace, :import rule /import\b/, Keyword::Namespace, :import # TODO: highlight backslash escapes rule /""".*?"""/m, Str::Double rule /'''.*?'''/m, Str::Single rule /"(\\.|\\\n|.)*?"/, Str::Double rule /'(\\.|\\\n|.)*?'/, Str::Single rule %r(\$/(\$.|.)*?/\$)m, Str rule %r(/(\\.|\\\n|.)*?/), Str rule /'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'/, Str::Char rule /(\.)([a-zA-Z_][a-zA-Z0-9_]*)/ do groups Operator, Name::Attribute end rule /[a-zA-Z_][a-zA-Z0-9_]*:/, Name::Label rule /[a-zA-Z_\$][a-zA-Z0-9_]*/ do |m| if self.class.keywords.include? m[0] token Keyword elsif self.class.declarations.include? m[0] token Keyword::Declaration elsif self.class.types.include? m[0] token Keyword::Type elsif self.class.constants.include? m[0] token Keyword::Constant else token Name end end rule %r([~^*!%&\[\](){}<>\|+=:;,./?-]), Operator # numbers rule /\d+\.\d+([eE]\d+)?[fd]?/, Num::Float rule /0x[0-9a-f]+/, Num::Hex rule /[0-9]+L?/, Num::Integer rule /\n/, Text end state :class do rule /\s+/, Text rule /\w[\w\d]*/, Name::Class, :pop! end state :import do rule /\s+/, Text rule /[\w\d.]+[*]?/, Name::Namespace, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/swift.rb0000644000175000017500000001130013150713277017344 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Swift < RegexLexer tag 'swift' filenames '*.swift' title "Swift" desc 'Multi paradigm, compiled programming language developed by Apple for iOS and OS X development. (developer.apple.com/swift)' id_head = /_|(?!\p{Mc})\p{Alpha}|[^\u0000-\uFFFF]/ id_rest = /[\p{Alnum}_]|[^\u0000-\uFFFF]/ id = /#{id_head}#{id_rest}*/ keywords = Set.new %w( break case continue default do else fallthrough if in for return switch where while try catch throw guard defer repeat as dynamicType is new super self Self Type __COLUMN__ __FILE__ __FUNCTION__ __LINE__ associativity didSet get infix inout mutating none nonmutating operator override postfix precedence prefix set unowned weak willSet throws rethrows precedencegroup ) declarations = Set.new %w( class deinit enum extension final func import init internal lazy let optional private protocol public required static struct subscript typealias var dynamic indirect associatedtype open fileprivate ) constants = Set.new %w( true false nil ) start { push :bol } # beginning of line state :bol do rule /#.*/, Comment::Preproc mixin :inline_whitespace rule(//) { pop! } end state :inline_whitespace do rule /\s+/m, Text mixin :has_comments end state :whitespace do rule /\n+/m, Text, :bol rule %r(\/\/.*?$), Comment::Single, :bol mixin :inline_whitespace end state :has_comments do rule %r(/[*]), Comment::Multiline, :nested_comment end state :nested_comment do mixin :has_comments rule %r([*]/), Comment::Multiline, :pop! rule %r([^*/]+)m, Comment::Multiline rule /./, Comment::Multiline end state :root do mixin :whitespace rule /\$(([1-9]\d*)?\d)/, Name::Variable rule %r{[()\[\]{}:;,?]}, Punctuation rule %r([-/=+*%<>!&|^.~]+), Operator rule /@?"/, Str, :dq rule /'(\\.|.)'/, Str::Char rule /(\d+\*|\d*\.\d+)(e[+-]?[0-9]+)?/i, Num::Float rule /\d+e[+-]?[0-9]+/i, Num::Float rule /0_?[0-7]+(?:_[0-7]+)*/, Num::Oct rule /0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*/, Num::Hex rule /0b[01]+(?:_[01]+)*/, Num::Bin rule %r{[\d]+(?:_\d+)*}, Num::Integer rule /@#{id}(\([^)]+\))?/, Keyword::Declaration rule /(private|internal)(\([ ]*)(\w+)([ ]*\))/ do |m| if m[3] == 'set' token Keyword::Declaration else groups Keyword::Declaration, Keyword::Declaration, Error, Keyword::Declaration end end rule /(unowned\([ ]*)(\w+)([ ]*\))/ do |m| if m[2] == 'safe' || m[2] == 'unsafe' token Keyword::Declaration else groups Keyword::Declaration, Error, Keyword::Declaration end end rule /#available\([^)]+\)/, Keyword::Declaration rule /(#(?:selector|keyPath)\()([^)]+?(?:[(].*?[)])?)(\))/ do groups Keyword::Declaration, Name::Function, Keyword::Declaration end rule /#(line|file|column|function|dsohandle)/, Keyword::Declaration rule /(let|var)\b(\s*)(#{id})/ do groups Keyword, Text, Name::Variable end rule /(?!\b(if|while|for|private|internal|unowned|switch|case)\b)\b#{id}(?=(\?|!)?\s*[(])/ do |m| if m[0] =~ /^[[:upper:]]/ token Keyword::Type else token Name::Function end end rule /as[?!]?(?=\s)/, Keyword rule /try[!]?(?=\s)/, Keyword rule /(#?(?!default)(?![[:upper:]])#{id})(\s*)(:)/ do groups Name::Variable, Text, Punctuation end rule id do |m| if keywords.include? m[0] token Keyword elsif declarations.include? m[0] token Keyword::Declaration elsif constants.include? m[0] token Keyword::Constant elsif m[0] =~ /^[[:upper:]]/ token Keyword::Type else token Name end end end state :dq do rule /\\[\\0tnr'"]/, Str::Escape rule /\\[(]/, Str::Escape, :interp rule /\\u\{\h{1,8}\}/, Str::Escape rule /[^\\"]+/, Str rule /"/, Str, :pop! end state :interp do rule /[(]/, Punctuation, :interp_inner rule /[)]/, Str::Escape, :pop! mixin :root end state :interp_inner do rule /[(]/, Punctuation, :push rule /[)]/, Punctuation, :pop! mixin :root end end end end rouge-2.2.1/lib/rouge/lexers/ini.rb0000644000175000017500000000215713150713277017001 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class INI < RegexLexer title "INI" desc 'the INI configuration format' tag 'ini' # TODO add more here filenames '*.ini', '*.INI', '*.gitconfig' mimetypes 'text/x-ini' def self.analyze_text(text) return 0.1 if text =~ /\A\[[\w\-.]+\]\s*[\w\-]+=\w+/ end identifier = /[\w\-.]+/ state :basic do rule /[;#].*?\n/, Comment rule /\s+/, Text rule /\\\n/, Str::Escape end state :root do mixin :basic rule /(#{identifier})(\s*)(=)/ do groups Name::Property, Text, Punctuation push :value end rule /\[.*?\]/, Name::Namespace end state :value do rule /\n/, Text, :pop! mixin :basic rule /"/, Str, :dq rule /'.*?'/, Str mixin :esc_str rule /[^\\\n]+/, Str end state :dq do rule /"/, Str, :pop! mixin :esc_str rule /[^\\"]+/m, Str end state :esc_str do rule /\\./m, Str::Escape end end end end rouge-2.2.1/lib/rouge/lexers/tsx.rb0000644000175000017500000000042113150713277017030 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers load_lexer 'jsx.rb' load_lexer 'typescript/common.rb' class TSX < JSX include TypescriptCommon title 'TypeScript' desc 'tsx' tag 'tsx' filenames '*.tsx' end end end rouge-2.2.1/lib/rouge/lexers/elixir.rb0000644000175000017500000001030513150713277017510 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers # Direct port of pygments Lexer. # See: https://bitbucket.org/birkenfeld/pygments-main/src/7304e4759ae65343d89a51359ca538912519cc31/pygments/lexers/functional.py?at=default#cl-2362 class Elixir < RegexLexer title "Elixir" desc "Elixir language (elixir-lang.org)" tag 'elixir' aliases 'elixir', 'exs' filenames '*.ex', '*.exs' mimetypes 'text/x-elixir', 'application/x-elixir' state :root do rule /\s+/m, Text rule /#.*$/, Comment::Single rule %r{\b(case|cond|end|bc|lc|if|unless|try|loop|receive|fn|defmodule| defp?|defprotocol|defimpl|defrecord|defmacrop?|defdelegate| defexception|exit|raise|throw|after|rescue|catch|else)\b(?![?!])| (?)\b}x, Keyword rule /\b(import|require|use|recur|quote|unquote|super|refer)\b(?![?!])/, Keyword::Namespace rule /(?|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?=[\s\t])\?| (?<=[\s\t])!+|&(&&?|(?!\d))|\|\||\^|\*|\+|\-|/| \||\+\+|\-\-|\*\*|\/\/|\<\-|\<\>|<<|>>|=|\.|~~~}x, Operator rule %r{(?=]))?|\<\>|===?|>=?|<=?| <=>|&&?|%\(\)|%\[\]|%\{\}|\+\+?|\-\-?|\|\|?|\!|//|[%&`/\|]| \*\*?|=?~|<\-)|([a-zA-Z_]\w*([?!])?)(:)(?!:)}, Str::Symbol rule /:"/, Str::Symbol, :interpoling_symbol rule /\b(nil|true|false)\b(?![?!])|\b[A-Z]\w*\b/, Name::Constant rule /\b(__(FILE|LINE|MODULE|MAIN|FUNCTION)__)\b(?![?!])/, Name::Builtin::Pseudo rule /[a-zA-Z_!][\w_]*[!\?]?/, Name rule %r{::|[%(){};,/\|:\\\[\]]}, Punctuation rule /@[a-zA-Z_]\w*|&\d/, Name::Variable rule %r{\b(0[xX][0-9A-Fa-f]+|\d(_?\d)*(\.(?![^\d\s]) (_?\d)*)?([eE][-+]?\d(_?\d)*)?|0[bB][01]+)\b}x, Num mixin :strings mixin :sigil_strings end state :strings do rule /(%[A-Ba-z])?"""(?:.|\n)*?"""/, Str::Doc rule /'''(?:.|\n)*?'''/, Str::Doc rule /"/, Str::Doc, :dqs rule /'.*?'/, Str::Single rule %r{(?, ~|abc|, ~r/abc/, etc # Cribbed and adjusted from Ruby lexer delimiter_map = { '{' => '}', '[' => ']', '(' => ')', '<' => '>' } # Match a-z for custom sigils too sigil_opens = Regexp.union(delimiter_map.keys + %w(| / ' ")) rule /~([A-Za-z])?(#{sigil_opens})/ do |m| open = Regexp.escape(m[2]) close = Regexp.escape(delimiter_map[m[2]] || m[2]) interp = /[SRCW]/ === m[1] toktype = Str::Other puts " open: #{open.inspect}" if @debug puts " close: #{close.inspect}" if @debug # regexes if 'Rr'.include? m[1] toktype = Str::Regex push :regex_flags end if 'Ww'.include? m[1] push :list_flags end token toktype push do rule /#{close}/, toktype, :pop! if interp mixin :interpoling rule /#/, toktype else rule /[\\#]/, toktype end rule /[^##{open}#{close}\\]+/m, toktype end end end state :regex_flags do rule /[fgimrsux]*/, Str::Regex, :pop! end state :list_flags do rule /[csa]?/, Str::Other, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/actionscript.rb0000644000175000017500000001161613150713277020724 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Actionscript < RegexLexer title "ActionScript" desc "ActionScript" tag 'actionscript' aliases 'as', 'as3' filenames '*.as' mimetypes 'application/x-actionscript' state :comments_and_whitespace do rule /\s+/, Text rule %r(//.*?$), Comment::Single rule %r(/\*.*?\*/)m, Comment::Multiline end state :expr_start do mixin :comments_and_whitespace rule %r(/) do token Str::Regex goto :regex end rule /[{]/, Punctuation, :object rule //, Text, :pop! end state :regex do rule %r(/) do token Str::Regex goto :regex_end end rule %r([^/]\n), Error, :pop! rule /\n/, Error, :pop! rule /\[\^/, Str::Escape, :regex_group rule /\[/, Str::Escape, :regex_group rule /\\./, Str::Escape rule %r{[(][?][:=>>? | === | !== )x, Operator, :expr_start rule %r([:-<>+*%&|\^/!=]=?), Operator, :expr_start rule /[(\[,]/, Punctuation, :expr_start rule /;/, Punctuation, :statement rule /[)\].]/, Punctuation rule /[?]/ do token Punctuation push :ternary push :expr_start end rule /[{}]/, Punctuation, :statement rule id do |m| if self.class.keywords.include? m[0] token Keyword push :expr_start elsif self.class.declarations.include? m[0] token Keyword::Declaration push :expr_start elsif self.class.reserved.include? m[0] token Keyword::Reserved elsif self.class.constants.include? m[0] token Keyword::Constant elsif self.class.builtins.include? m[0] token Name::Builtin else token Name::Other end end rule /\-?[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?/, Num::Float rule /0x[0-9a-fA-F]+/, Num::Hex rule /\-?[0-9]+/, Num::Integer rule /"(\\\\|\\"|[^"])*"/, Str::Double rule /'(\\\\|\\'|[^'])*'/, Str::Single end # braced parts that aren't object literals state :statement do rule /(#{id})(\s*)(:)/ do groups Name::Label, Text, Punctuation end rule /[{}]/, Punctuation mixin :expr_start end # object literals state :object do mixin :comments_and_whitespace rule /[}]/ do token Punctuation goto :statement end rule /(#{id})(\s*)(:)/ do groups Name::Attribute, Text, Punctuation push :expr_start end rule /:/, Punctuation mixin :root end # ternary expressions, where : is not a label! state :ternary do rule /:/ do token Punctuation goto :expr_start end mixin :root end end end end rouge-2.2.1/lib/rouge/lexers/moonscript.rb0000644000175000017500000000631013150713277020412 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers load_lexer 'lua.rb' class Moonscript < RegexLexer title "MoonScript" desc "Moonscript (http://www.moonscript.org)" tag 'moonscript' aliases 'moon' filenames '*.moon' mimetypes 'text/x-moonscript', 'application/x-moonscript' option :function_highlighting, 'Whether to highlight builtin functions (default: true)' option :disabled_modules, 'builtin modules to disable' def initialize(*) super @function_highlighting = bool_option(:function_highlighting) { true } @disabled_modules = list_option(:disabled_modules) end def self.analyze_text(text) return 1 if text.shebang? 'moon' end def builtins return [] unless @function_highlighting @builtins ||= Set.new.tap do |builtins| Rouge::Lexers::Lua.builtins.each do |mod, fns| next if @disabled_modules.include? mod builtins.merge(fns) end end end state :root do rule %r(#!(.*?)$), Comment::Preproc # shebang rule //, Text, :main end state :base do ident = '(?:[\w_][\w\d_]*)' rule %r((?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?'), Num::Float rule %r((?i)\d+e[+-]?\d+), Num::Float rule %r((?i)0x[0-9a-f]*), Num::Hex rule %r(\d+), Num::Integer rule %r(@#{ident}*), Name::Variable::Instance rule %r([A-Z][\w\d_]*), Name::Class rule %r("?[^"]+":), Literal::String::Symbol rule %r(#{ident}:), Literal::String::Symbol rule %r(:#{ident}), Literal::String::Symbol rule %r(\s+), Text::Whitespace rule %r((==|~=|!=|<=|>=|\.\.\.|\.\.|->|=>|[=+\-*/%^<>#!\\])), Operator rule %r([\[\]\{\}\(\)\.,:;]), Punctuation rule %r((and|or|not)\b), Operator::Word keywords = %w{ break class continue do else elseif end extends for if import in repeat return switch super then unless until using when with while } rule %r((#{keywords.join('|')})\b), Keyword rule %r((local|export)\b), Keyword::Declaration rule %r((true|false|nil)\b), Keyword::Constant rule %r([A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)?) do |m| name = m[0] if self.builtins.include?(name) token Name::Builtin elsif name =~ /\./ a, b = name.split('.', 2) token Name, a token Punctuation, '.' token Name, b else token Name end end end state :main do rule %r(--.*$), Comment::Single rule %r(\[(=*)\[.*?\]\1\])m, Str::Heredoc mixin :base rule %r('), Str::Single, :sqs rule %r("), Str::Double, :dqs end state :sqs do rule %r('), Str::Single, :pop! rule %r([^']+), Str::Single end state :interpolation do rule %r(\}), Str::Interpol, :pop! mixin :base end state :dqs do rule %r(#\{), Str::Interpol, :interpolation rule %r("), Str::Double, :pop! rule %r(#[^{]), Str::Double rule %r([^"#]+), Str::Double end end end end rouge-2.2.1/lib/rouge/lexers/make.rb0000644000175000017500000000530213150713277017132 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Make < RegexLexer title "Make" desc "Makefile syntax" tag 'make' aliases 'makefile', 'mf', 'gnumake', 'bsdmake' filenames '*.make', 'Makefile', 'makefile', 'Makefile.*', 'GNUmakefile' mimetypes 'text/x-makefile' def self.analyze_text(text) return 0.6 if text =~ /^\.PHONY:/ end bsd_special = %w( include undef error warning if else elif endif for endfor ) gnu_special = %w( ifeq ifneq ifdef ifndef else endif include -include define endef : ) line = /(?:\\.|\\\n|[^\\\n])*/m def initialize(opts={}) super @shell = Shell.new(opts) end start { @shell.reset! } state :root do rule /\s+/, Text rule /#.*?\n/, Comment rule /(export)(\s+)(?=[a-zA-Z0-9_\${}\t -]+\n)/ do groups Keyword, Text push :export end rule /export\s+/, Keyword # assignment rule /([a-zA-Z0-9_${}.-]+)(\s*)([!?:+]?=)/m do |m| token Name::Variable, m[1] token Text, m[2] token Operator, m[3] push :shell_line end rule /"(\\\\|\\.|[^"\\])*"/, Str::Double rule /'(\\\\|\\.|[^'\\])*'/, Str::Single rule /([^\n:]+)(:+)([ \t]*)/ do groups Name::Label, Operator, Text push :block_header end end state :export do rule /[\w\${}-]/, Name::Variable rule /\n/, Text, :pop! rule /\s+/, Text end state :block_header do rule /[^,\\\n#]+/, Name::Function rule /,/, Punctuation rule /#.*?/, Comment rule /\\\n/, Text rule /\\./, Text rule /\n/ do token Text goto :block_body end end state :block_body do rule /(\t[\t ]*)([@-]?)/ do |m| groups Text, Punctuation push :shell_line end rule(//) { @shell.reset!; pop! } end state :shell do # macro interpolation rule /\$\(\s*[a-z_]\w*\s*\)/i, Name::Variable # $(shell ...) rule /(\$\()(\s*)(shell)(\s+)/m do groups Name::Function, Text, Name::Builtin, Text push :shell_expr end rule(/\\./m) { delegate @shell } stop = /\$\(|\(|\)|\\|$/ rule(/.+?(?=#{stop})/m) { delegate @shell } rule(stop) { delegate @shell } end state :shell_expr do rule(/\(/) { delegate @shell; push } rule /\)/, Name::Variable, :pop! mixin :shell end state :shell_line do rule /\n/, Text, :pop! mixin :shell end end end end rouge-2.2.1/lib/rouge/lexers/ocaml.rb0000644000175000017500000000557613150713277017325 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class OCaml < RegexLexer title "OCaml" desc 'Objective Caml (ocaml.org)' tag 'ocaml' filenames '*.ml', '*.mli', '*.mll', '*.mly' mimetypes 'text/x-ocaml' def self.keywords @keywords ||= Set.new %w( as assert begin class constraint do done downto else end exception external false for fun function functor if in include inherit initializer lazy let match method module mutable new nonrec object of open private raise rec sig struct then to true try type val virtual when while with ) end def self.word_operators @word_operators ||= Set.new %w(and asr land lor lsl lxor mod or) end def self.primitives @primitives ||= Set.new %w(unit int float bool string char list array) end operator = %r([;,_!$%&*+./:<=>?@^|~#-]+) id = /[a-z_][\w']*/i upper_id = /[A-Z][\w']*/ state :root do rule /\s+/m, Text rule /false|true|[(][)]|\[\]/, Name::Builtin::Pseudo rule /#{upper_id}(?=\s*[.])/, Name::Namespace, :dotted rule /`#{id}/, Name::Tag rule upper_id, Name::Class rule /[(][*](?![)])/, Comment, :comment rule id do |m| match = m[0] if self.class.keywords.include? match token Keyword elsif self.class.word_operators.include? match token Operator::Word elsif self.class.primitives.include? match token Keyword::Type else token Name end end rule /[(){}\[\];]+/, Punctuation rule operator, Operator rule /-?\d[\d_]*(.[\d_]*)?(e[+-]?\d[\d_]*)/i, Num::Float rule /0x\h[\h_]*/i, Num::Hex rule /0o[0-7][0-7_]*/i, Num::Oct rule /0b[01][01_]*/i, Num::Bin rule /\d[\d_]*/, Num::Integer rule /'(?:(\\[\\"'ntbr ])|(\\[0-9]{3})|(\\x\h{2}))'/, Str::Char rule /'[.]'/, Str::Char rule /'/, Keyword rule /"/, Str::Double, :string rule /[~?]#{id}/, Name::Variable end state :comment do rule /[^(*)]+/, Comment rule(/[(][*]/) { token Comment; push } rule /[*][)]/, Comment, :pop! rule /[(*)]/, Comment end state :string do rule /[^\\"]+/, Str::Double mixin :escape_sequence rule /\\\n/, Str::Double rule /"/, Str::Double, :pop! end state :escape_sequence do rule /\\[\\"'ntbr]/, Str::Escape rule /\\\d{3}/, Str::Escape rule /\\x\h{2}/, Str::Escape end state :dotted do rule /\s+/m, Text rule /[.]/, Punctuation rule /#{upper_id}(?=\s*[.])/, Name::Namespace rule upper_id, Name::Class, :pop! rule id, Name, :pop! rule /[({\[]/, Punctuation, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/idlang.rb0000644000175000017500000003131313150713277017454 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # # vim: set ts=2 sw=2 et: module Rouge module Lexers class IDLang < RegexLexer title "IDL" desc "Interactive Data Language" tag 'idlang' filenames '*.idl' def self.analyze_text(text) # Does there exist a statement that starts with 'pro' or # 'function'? return 0.4 if text =~ /^\s+(pro|function)\z/ end name = /[_A-Z]\w*/i kind_param = /(\d+|#{name})/ exponent = /[dDeE][+-]\d+/ def self.exec_unit @exec_unit ||= Set.new %w( PRO FUNCTION ) end def self.keywords @keywords ||= Set.new %w( STRUCT INHERITS RETURN CONTINUE BEGIN END BREAK GOTO ) end def self.standalone_statements # Must not have a comma afterwards @standalone_statements ||= Set.new %w( COMMON FORWARD_FUNCTION ) end def self.decorators # Must not have a comma afterwards @decorators ||= Set.new %w( COMPILE_OPT ) end def self.operators @operators ||= Set.new %w( AND= EQ= GE= GT= LE= LT= MOD= NE= OR= XOR= NOT= ) end def self.conditionals @conditionals ||= Set.new %w( OF DO ENDIF ENDELSE ENDFOR ENDFOREACH ENDWHILE ENDREP ENDCASE ENDSWITCH IF THEN ELSE FOR FOREACH WHILE REPEAT UNTIL CASE SWITCH AND EQ GE GT LE LT MOD NE OR XOR NOT ) end def self.routines @routines ||= Set.new %w( A_CORRELATE ABS ACOS ADAPT_HIST_EQUAL ALOG ALOG10 AMOEBA ANNOTATE ARG_PRESENT ARRAY_EQUAL ARRAY_INDICES ARROW ASCII_TEMPLATE ASIN ASSOC ATAN AXIS BAR_PLOT BESELI BESELJ BESELK BESELY BETA BILINEAR BIN_DATE BINARY_TEMPLATE BINDGEN BINOMIAL BLAS_AXPY BLK_CON BOX_CURSOR BREAK BREAKPOINT BROYDEN BYTARR BYTE BYTEORDER BYTSCL C_CORRELATE CALDAT CALENDAR CALL_EXTERNAL CALL_FUNCTION CALL_METHOD CALL_PROCEDURE CATCH CD CEIL CHEBYSHEV CHECK_MATH CHISQR_CVF CHISQR_PDF CHOLDC CHOLSOL CINDGEN CIR_3PNT CLOSE CLUST_WTS CLUSTER COLOR_CONVERT COLOR_QUAN COLORMAP_APPLICABLE COMFIT COMPLEX COMPLEXARR COMPLEXROUND COMPUTE_MESH_NORMALS COND CONGRID CONJ CONSTRAINED_MIN CONTOUR CONVERT_COORD CONVOL COORD2TO3 CORRELATE COS COSH CRAMER CREATE_STRUCT CREATE_VIEW CROSSP CRVLENGTH CT_LUMINANCE CTI_TEST CURSOR CURVEFIT CV_COORD CVTTOBM CW_ANIMATE CW_ANIMATE_GETP CW_ANIMATE_LOAD CW_ANIMATE_RUN CW_ARCBALL CW_BGROUP CW_CLR_INDEX CW_COLORSEL CW_DEFROI CW_FIELD CW_FILESEL CW_FORM CW_FSLIDER CW_LIGHT_EDITOR CW_LIGHT_EDITOR_GET CW_LIGHT_EDITOR_SET CW_ORIENT CW_PALETTE_EDITOR CW_PALETTE_EDITOR_GET CW_PALETTE_EDITOR_SET CW_PDMENU CW_RGBSLIDER CW_TMPL CW_ZOOM DBLARR DCINDGEN DCOMPLEX DCOMPLEXARR DEFINE_KEY DEFROI DEFSYSV DELETE_SYMBOL DELLOG DELVAR DERIV DERIVSIG DETERM DEVICE DFPMIN DIALOG_MESSAGE DIALOG_PICKFILE DIALOG_PRINTERSETUP DIALOG_PRINTJOB DIALOG_READ_IMAGE DIALOG_WRITE_IMAGE DICTIONARY DIGITAL_FILTER DILATE DINDGEN DISSOLVE DIST DLM_LOAD DLM_REGISTER DO_APPLE_SCRIPT DOC_LIBRARY DOUBLE DRAW_ROI EFONT EIGENQL EIGENVEC ELMHES EMPTY ENABLE_SYSRTN EOF ERASE ERODE ERRORF ERRPLOT EXECUTE EXIT EXP EXPAND EXPAND_PATH EXPINT EXTRAC EXTRACT_SLICE F_CVF F_PDF FACTORIAL FFT FILE_CHMOD FILE_DELETE FILE_EXPAND_PATH FILE_MKDIR FILE_TEST FILE_WHICH FILE_SEARCH PATH_SEP FILE_DIRNAME FILE_BASENAME FILE_INFO FILE_MOVE FILE_COPY FILE_LINK FILE_POLL_INPUT FILEPATH FINDFILE FINDGEN FINITE FIX FLICK FLOAT FLOOR FLOW3 FLTARR FLUSH FORMAT_AXIS_VALUES FORWARD_FUNCTION FREE_LUN FSTAT FULSTR FUNCT FV_TEST FX_ROOT FZ_ROOTS GAMMA GAMMA_CT GAUSS_CVF GAUSS_PDF GAUSS2DFIT GAUSSFIT GAUSSINT GET_DRIVE_LIST GET_KBRD GET_LUN GET_SCREEN_SIZE GET_SYMBOL GETENV GOTO GREG2JUL GRID_TPS GRID3 GS_ITER H_EQ_CT H_EQ_INT HANNING HASH HEAP_GC HELP HILBERT HIST_2D HIST_EQUAL HISTOGRAM HLS HOUGH HQR HSV IBETA IDENTITY IDL_CONTAINER IDLANROI IDLANROIGROUP IDLFFDICOM IDLFFDXF IDLFFLANGUAGECAT IDLFFSHAPE IDLGRAXIS IDLGRBUFFER IDLGRCLIPBOARD IDLGRCOLORBAR IDLGRCONTOUR IDLGRFONT IDLGRIMAGE IDLGRLEGEND IDLGRLIGHT IDLGRMODEL IDLGRMPEG IDLGRPALETTE IDLGRPATTERN IDLGRPLOT IDLGRPOLYGON IDLGRPOLYLINE IDLGRPRINTER IDLGRROI IDLGRROIGROUP IDLGRSCENE IDLGRSURFACE IDLGRSYMBOL IDLGRTESSELLATOR IDLGRTEXT IDLGRVIEW IDLGRVIEWGROUP IDLGRVOLUME IDLGRVRML IDLGRWINDOW IGAMMA IMAGE_CONT IMAGE_STATISTICS IMAGINARY INDGEN INT_2D INT_3D INT_TABULATED INTARR INTERPOL INTERPOLATE INVERT IOCTL ISA ISHFT ISOCONTOUR ISOSURFACE JOURNAL JUL2GREG JULDAY KEYWORD_SET KRIG2D KURTOSIS KW_TEST L64INDGEN LABEL_DATE LABEL_REGION LADFIT LAGUERRE LEEFILT LEGENDRE LINBCG LINDGEN LINFIT LINKIMAGE LIST LIVE_CONTOUR LIVE_CONTROL LIVE_DESTROY LIVE_EXPORT LIVE_IMAGE LIVE_INFO LIVE_LINE LIVE_LOAD LIVE_OPLOT LIVE_PLOT LIVE_PRINT LIVE_RECT LIVE_STYLE LIVE_SURFACE LIVE_TEXT LJLCT LL_ARC_DISTANCE LMFIT LMGR LNGAMMA LNP_TEST LOADCT LOCALE_GET LON64ARR LONARR LONG LONG64 LSODE LU_COMPLEX LUDC LUMPROVE LUSOL M_CORRELATE MACHAR MAKE_ARRAY MAKE_DLL MAP_2POINTS MAP_CONTINENTS MAP_GRID MAP_IMAGE MAP_PATCH MAP_PROJ_INFO MAP_SET MAX MATRIX_MULTIPLY MD_TEST MEAN MEANABSDEV MEDIAN MEMORY MESH_CLIP MESH_DECIMATE MESH_ISSOLID MESH_MERGE MESH_NUMTRIANGLES MESH_OBJ MESH_SMOOTH MESH_SURFACEAREA MESH_VALIDATE MESH_VOLUME MESSAGE MIN MIN_CURVE_SURF MK_HTML_HELP MODIFYCT MOMENT MORPH_CLOSE MORPH_DISTANCE MORPH_GRADIENT MORPH_HITORMISS MORPH_OPEN MORPH_THIN MORPH_TOPHAT MPEG_CLOSE MPEG_OPEN MPEG_PUT MPEG_SAVE MSG_CAT_CLOSE MSG_CAT_COMPILE MSG_CAT_OPEN MULTI N_ELEMENTS N_PARAMS N_TAGS NEWTON NORM OBJ_CLASS OBJ_DESTROY OBJ_ISA OBJ_NEW OBJ_VALID OBJARR ON_ERROR ON_IOERROR ONLINE_HELP OPEN OPENR OPENW OPENU OPLOT OPLOTERR ORDEREDHASH P_CORRELATE PARTICLE_TRACE PCOMP PLOT PLOT_3DBOX PLOT_FIELD PLOTERR PLOTS PNT_LINE POINT_LUN POLAR_CONTOUR POLAR_SURFACE POLY POLY_2D POLY_AREA POLY_FIT POLYFILL POLYFILLV POLYSHADE POLYWARP POPD POWELL PRIMES PRINT PRINTF PRINTD PRODUCT PROFILE PROFILER PROFILES PROJECT_VOL PS_SHOW_FONTS PSAFM PSEUDO PTR_FREE PTR_NEW PTR_VALID PTRARR PUSHD QROMB QROMO QSIMP QUERY_CSV R_CORRELATE R_TEST RADON RANDOMN RANDOMU RANKS RDPIX READ READF READ_ASCII READ_BINARY READ_BMP READ_CSV READ_DICOM READ_IMAGE READ_INTERFILE READ_JPEG READ_PICT READ_PNG READ_PPM READ_SPR READ_SRF READ_SYLK READ_TIFF READ_WAV READ_WAVE READ_X11_BITMAP READ_XWD READS READU REBIN RECALL_COMMANDS RECON3 REDUCE_COLORS REFORM REGRESS REPLICATE REPLICATE_INPLACE RESOLVE_ALL RESOLVE_ROUTINE RESTORE RETALL REVERSE REWIND RK4 ROBERTS ROT ROTATE ROUND ROUTINE_INFO RS_TEST S_TEST SAVE SAVGOL SCALE3 SCALE3D SCOPE_LEVEL SCOPE_TRACEBACK SCOPE_VARFETCH SCOPE_VARNAME SEARCH2D SEARCH3D SET_PLOT SET_SHADING SET_SYMBOL SETENV SETLOG SETUP_KEYS SFIT SHADE_SURF SHADE_SURF_IRR SHADE_VOLUME SHIFT SHOW3 SHOWFONT SIGNUM SIN SINDGEN SINH SIZE SKEWNESS SKIPF SLICER3 SLIDE_IMAGE SMOOTH SOBEL SOCKET SORT SPAWN SPH_4PNT SPH_SCAT SPHER_HARM SPL_INIT SPL_INTERP SPLINE SPLINE_P SPRSAB SPRSAX SPRSIN SPRSTP SQRT STANDARDIZE STDDEV STOP STRARR STRCMP STRCOMPRESS STREAMLINE STREGEX STRETCH STRING STRJOIN STRLEN STRLOWCASE STRMATCH STRMESSAGE STRMID STRPOS STRPUT STRSPLIT STRTRIM STRUCT_ASSIGN STRUCT_HIDE STRUPCASE SURFACE SURFR SVDC SVDFIT SVSOL SWAP_ENDIAN SWITCH SYSTIME T_CVF T_PDF T3D TAG_NAMES TAN TANH TAPRD TAPWRT TEK_COLOR TEMPORARY TETRA_CLIP TETRA_SURFACE TETRA_VOLUME THIN THREED TIME_TEST2 TIMEGEN TM_TEST TOTAL TRACE TRANSPOSE TRI_SURF TRIANGULATE TRIGRID TRIQL TRIRED TRISOL TRNLOG TS_COEF TS_DIFF TS_FCAST TS_SMOOTH TV TVCRS TVLCT TVRD TVSCL TYPENAME UINDGEN UINT UINTARR UL64INDGEN ULINDGEN ULON64ARR ULONARR ULONG ULONG64 UNIQ USERSYM VALUE_LOCATE VARIANCE VAX_FLOAT VECTOR_FIELD VEL VELOVECT VERT_T3D VOIGT VORONOI VOXEL_PROJ WAIT WARP_TRI WATERSHED WDELETE WEOF WF_DRAW WHERE WIDGET_BASE WIDGET_BUTTON WIDGET_CONTROL WIDGET_DRAW WIDGET_DROPLIST WIDGET_EVENT WIDGET_INFO WIDGET_LABEL WIDGET_LIST WIDGET_SLIDER WIDGET_TABLE WIDGET_TEXT WINDOW WRITE_BMP WRITE_CSV WRITE_IMAGE WRITE_JPEG WRITE_NRIF WRITE_PICT WRITE_PNG WRITE_PPM WRITE_SPR WRITE_SRF WRITE_SYLK WRITE_TIFF WRITE_WAV WRITE_WAVE WRITEU WSET WSHOW WTN WV_APPLET WV_CW_WAVELET WV_CWT WV_DENOISE WV_DWT WV_FN_COIFLET WV_FN_DAUBECHIES WV_FN_GAUSSIAN WV_FN_HAAR WV_FN_MORLET WV_FN_PAUL WV_FN_SYMLET WV_IMPORT_DATA WV_IMPORT_WAVELET WV_PLOT3D_WPS WV_PLOT_MULTIRES WV_PWT WV_TOOL_DENOISE XBM_EDIT XDISPLAYFILE XDXF XFONT XINTERANIMATE XLOADCT XMANAGER XMNG_TMPL XMTOOL XOBJVIEW XPALETTE XPCOLOR XPLOT3D XREGISTERED XROI XSQ_TEST XSURFACE XVAREDIT XVOLUME XVOLUME_ROTATE XVOLUME_WRITE_IMAGE XYOUTS ZOOM ZOOM_24 ) end state :root do rule /[\s\n]+/, Text::Whitespace # Normal comments rule /;.*$/, Comment::Single rule /\,\s*\,/, Error rule /\!#{name}/, Name::Variable::Global rule /[(),:\&\$]/, Punctuation ## Format statements are quite a strange beast. ## Better process them in their own state. #rule /\b(FORMAT)(\s*)(\()/mi do |m| # token Keyword, m[1] # token Text::Whitespace, m[2] # token Punctuation, m[3] # push :format_spec #end rule %r( [+-]? # sign ( (\d+[.]\d*|[.]\d+)(#{exponent})? | \d+#{exponent} # exponent is mandatory ) (_#{kind_param})? # kind parameter )xi, Num::Float rule /\d+(B|S|U|US|LL|L|ULL|UL)?/i, Num::Integer rule /"[0-7]+(B|O|U|ULL|UL|LL|L)?/i, Num::Oct rule /'[0-9A-F]+'X(B|S|US|ULL|UL|U|LL|L)?/i, Num::Hex rule /(#{kind_param}_)?'/, Str::Single, :string_single rule /(#{kind_param}_)?"/, Str::Double, :string_double rule %r{\#\#|\#|\&\&|\|\||/=|<=|>=|->|\@|\?|[-+*/<=~^{}]}, Operator # Structures and the like rule /(#{name})(\.)([^\s,]*)/i do |m| groups Name, Operator, Name #delegate IDLang, m[3] end rule /(function|pro)((?:\s|\$\s)+)/i do groups Keyword, Text::Whitespace push :funcname end rule /#{name}/m do |m| match = m[0].upcase if self.class.keywords.include? match token Keyword elsif self.class.conditionals.include? match token Keyword elsif self.class.decorators.include? match token Name::Decorator elsif self.class.standalone_statements.include? match token Keyword::Reserved elsif self.class.operators.include? match token Operator::Word elsif self.class.routines.include? match token Name::Builtin else token Name end end end state :funcname do rule /#{name}/, Name::Function rule /\s+/, Text::Whitespace rule /(:+|\$)/, Operator rule /;.*/, Comment::Single # Be done with this state if we hit EOL or comma rule /$/, Text::Whitespace, :pop! rule /,/, Operator, :pop! end state :string_single do rule /[^']+/, Str::Single rule /''/, Str::Escape rule /'/, Str::Single, :pop! end state :string_double do rule /[^"]+/, Str::Double rule /"/, Str::Double, :pop! end state :format_spec do rule /'/, Str::Single, :string_single rule /"/, Str::Double, :string_double rule /\(/, Punctuation, :format_spec rule /\)/, Punctuation, :pop! rule /,/, Punctuation rule /[\s\n]+/, Text::Whitespace # Edit descriptors could be seen as a kind of "format literal". rule /[^\s'"(),]+/, Literal end end end end rouge-2.2.1/lib/rouge/lexers/prolog.rb0000644000175000017500000000311213150713277017514 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Prolog < RegexLexer title "Prolog" desc "The Prolog programming language (http://en.wikipedia.org/wiki/Prolog)" tag 'prolog' aliases 'prolog' filenames '*.pro', '*.P', '*.prolog', '*.pl' mimetypes 'text/x-prolog' def self.analyze_text(text) return 0.1 if text =~ /\A\w+(\(\w+\,\s*\w+\))*\./ return 0.1 if text.include? ':-' end state :basic do rule /\s+/, Text rule /^#.*/, Comment::Single rule /\/\*/, Comment::Multiline, :nested_comment rule /[\[\](){}|.,;!]/, Punctuation rule /:-|-->/, Punctuation rule /"[^"]*"/, Str::Double rule /\d+\.\d+/, Num::Float rule /\d+/, Num end state :atoms do rule /[[:lower:]]([_[:word:][:digit:]])*/, Str::Symbol rule /'[^']*'/, Str::Symbol end state :operators do rule /(<|>|=<|>=|==|=:=|=|\/|\/\/|\*|\+|-)(?=\s|[a-zA-Z0-9\[])/, Operator rule /is/, Operator rule /(mod|div|not)/, Operator rule /[#&*+-.\/:<=>?@^~]+/, Operator end state :variables do rule /[A-Z]+\w*/, Name::Variable rule /_[[:word:]]*/, Name::Variable end state :root do mixin :basic mixin :atoms mixin :variables mixin :operators end state :nested_comment do rule /\/\*/, Comment::Multiline, :push rule /\s*\*[^*\/]+/, Comment::Multiline rule /\*\//, Comment::Multiline, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/vala.rb0000644000175000017500000000421713150713277017144 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Vala < RegexLexer tag 'vala' filenames '*.vala' mimetypes 'text/x-vala' title "Vala" desc 'A programming language similar to csharp.' id = /@?[_a-z]\w*/i keywords = %w( abstract as async base break case catch const construct continue default delegate delete do dynamic else ensures enum errordomain extern false finally for foreach get global if in inline interface internal is lock new null out override owned private protected public ref requires return set signal sizeof static switch this throw throws true try typeof unowned var value virtual void weak while yield ) keywords_type = %w( bool char double float int int8 int16 int32 int64 long short size_t ssize_t string unichar uint uint8 uint16 uint32 uint64 ulong ushort ) state :whitespace do rule /\s+/m, Text rule %r(//.*?$), Comment::Single rule %r(/[*].*?[*]/)m, Comment::Multiline end state :root do mixin :whitespace rule /^\s*\[.*?\]/, Name::Attribute rule /(<\[)\s*(#{id}:)?/, Keyword rule /\]>/, Keyword rule /[~!%^&*()+=|\[\]{}:;,.<>\/?-]/, Punctuation rule /@"(\\.|.)*?"/, Str rule /"(\\.|.)*?["\n]/, Str rule /'(\\.|.)'/, Str::Char rule /0x[0-9a-f]+[lu]?/i, Num rule %r( [0-9] ([.][0-9]*)? # decimal (e[+-][0-9]+)? # exponent [fldu]? # type )ix, Num rule /\b(#{keywords.join('|')})\b/, Keyword rule /\b(#{keywords_type.join('|')})\b/, Keyword::Type rule /class|struct/, Keyword, :class rule /namespace|using/, Keyword, :namespace rule /#{id}(?=\s*[(])/, Name::Function rule id, Name rule /#.*/, Comment::Preproc end state :class do mixin :whitespace rule id, Name::Class, :pop! end state :namespace do mixin :whitespace rule /(?=[(])/, Text, :pop! rule /(#{id}|[.])+/, Name::Namespace, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/mosel.rb0000644000175000017500000002150513150713277017337 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Mosel < RegexLexer tag 'mosel' filenames '*.mos' title "Mosel" desc "An optimization language used by Fico's Xpress." # http://www.fico.com/en/products/fico-xpress-optimization-suite filenames '*.mos' mimetypes 'text/x-mosel' def self.analyze_text(text) return 1 if text =~ /^\s*(model|package)\s+/ end id = /[a-zA-Z_][a-zA-Z0-9_]*/ ############################################################################################################################ # General language lements ############################################################################################################################ core_keywords = %w( and array as boolean break case count counter declarations div do dynamic elif else end evaluation exit false forall forward from function if imports in include initialisations initializations integer inter is_binary is_continuous is_free is_integer is_partint is_semcont is_semint is_sos1 is_sos2 linctr list max min mod model mpvar next not of options or package parameters procedure public prod range real record repeat requirements set string sum then to true union until uses version while with ) core_functions = %w( abs arctan assert bitflip bitneg bitset bitshift bittest bitval ceil cos create currentdate currenttime cuthead cuttail delcell exists exit exp exportprob fclose fflush finalize findfirst findlast floor fopen fselect fskipline getact getcoeff getcoeffs getdual getfid getfirst gethead getfname getlast getobjval getparam getrcost getreadcnt getreverse getsize getslack getsol gettail gettype getvars iseof ishidden isodd ln log makesos1 makesos2 maxlist minlist publish random read readln reset reverse round setcoeff sethidden setioerr setname setparam setrandseed settype sin splithead splittail sqrt strfmt substr timestamp unpublish write writeln ) ############################################################################################################################ # mmxprs module elements ############################################################################################################################ mmxprs_functions = %w( addmipsol basisstability calcsolinfo clearmipdir clearmodcut command copysoltoinit defdelayedrows defsecurevecs estimatemarginals fixglobal getbstat getdualray getiis getiissense getiistype getinfcause getinfeas getlb getloadedlinctrs getloadedmpvars getname getprimalray getprobstat getrange getsensrng getsize getsol getub getvars implies indicator isiisvalid isintegral loadbasis loadmipsol loadprob maximize minimize postsolve readbasis readdirs readsol refinemipsol rejectintsol repairinfeas resetbasis resetiis resetsol savebasis savemipsol savesol savestate selectsol setbstat setcallback setcbcutoff setgndata setlb setmipdir setmodcut setsol setub setucbdata stopoptimize unloadprob writebasis writedirs writeprob writesol xor ) mmxpres_constants = %w(XPRS_OPT XPRS_UNF XPRS_INF XPRS_UNB XPRS_OTH) mmxprs_parameters = %w(XPRS_colorder XPRS_enumduplpol XPRS_enummaxsol XPRS_enumsols XPRS_fullversion XPRS_loadnames XPRS_problem XPRS_probname XPRS_verbose) ############################################################################################################################ # mmsystem module elements ############################################################################################################################ mmsystem_functions = %w( addmonths copytext cuttext deltext endswith expandpath fcopy fdelete findfiles findtext fmove getasnumber getchar getcwd getdate getday getdaynum getdays getdirsep getendparse setendparse getenv getfsize getfstat getftime gethour getminute getmonth getmsec getpathsep getqtype setqtype getsecond getsepchar setsepchar getsize getstart setstart getsucc setsucc getsysinfo getsysstat gettime gettmpdir gettrim settrim getweekday getyear inserttext isvalid makedir makepath newtar newzip nextfield openpipe parseextn parseint parsereal parsetext pastetext pathmatch pathsplit qsort quote readtextline regmatch regreplace removedir removefiles setchar setdate setday setenv sethour setminute setmonth setmsec setsecond settime setyear sleep startswith system tarlist textfmt tolower toupper trim untar unzip ziplist ) mmsystem_parameters = %w(datefmt datetimefmt monthnames sys_endparse sys_fillchar sys_pid sys_qtype sys_regcache sys_sepchar) ############################################################################################################################ # mmjobs module elements ############################################################################################################################ mmjobs_instance_mgmt_functions = %w( clearaliases connect disconnect findxsrvs getaliases getbanner gethostalias sethostalias ) mmjobs_model_mgmt_functions = %w( compile detach getannidents getannotations getexitcode getgid getid getnode getrmtid getstatus getuid load reset resetmodpar run setcontrol setdefstream setmodpar setworkdir stop unload ) mmjobs_synchornization_functions = %w( dropnextevent getclass getfromgid getfromid getfromuid getnextevent getvalue isqueueempty nullevent peeknextevent send setgid setuid wait waitfor ) mmjobs_functions = mmjobs_instance_mgmt_functions + mmjobs_model_mgmt_functions + mmjobs_synchornization_functions mmjobs_parameters = %w(conntmpl defaultnode fsrvdelay fsrvnbiter fsrvport jobid keepalive nodenumber parentnumber) state :whitespace do # Spaces rule /\s+/m, Text # ! Comments rule %r((!).*$\n?), Comment::Single # (! Comments !) rule %r(\(!.*?!\))m, Comment::Multiline end # From Mosel documentation: # Constant strings of characters must be quoted with single (') or double quote (") and may extend over several lines. Strings enclosed in double quotes may contain C-like escape sequences introduced by the 'backslash' # character (\a \b \f \n \r \t \v \xxx with xxx being the character code as an octal number). # Each sequence is replaced by the corresponding control character (e.g. \n is the `new line' command) or, if no control character exists, by the second character of the sequence itself (e.g. \\ is replaced by '\'). # The escape sequences are not interpreted if they are contained in strings that are enclosed in single quotes. state :single_quotes do rule /'/, Str::Single, :pop! rule /[^']+/, Str::Single end state :double_quotes do rule /"/, Str::Double, :pop! rule /(\\"|\\[0-7]{1,3}\D|\\[abfnrtv]|\\\\)/, Str::Escape rule /[^"]/, Str::Double end state :base do rule %r{"}, Str::Double, :double_quotes rule %r{'}, Str::Single, :single_quotes rule %r{((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?}, Num rule %r{[~!@#\$%\^&\*\(\)\+`\-={}\[\]:;<>\?,\.\/\|\\]}, Punctuation # rule %r{'([^']|'')*'}, Str # rule /"(\\\\|\\"|[^"])*"/, Str rule /(true|false)\b/i, Name::Builtin rule /\b(#{core_keywords.join('|')})\b/i, Keyword rule /\b(#{core_functions.join('|')})\b/, Name::Builtin rule /\b(#{mmxprs_functions.join('|')})\b/, Name::Function rule /\b(#{mmxpres_constants.join('|')})\b/, Name::Constant rule /\b(#{mmxprs_parameters.join('|')})\b/i, Name::Property rule /\b(#{mmsystem_functions.join('|')})\b/i, Name::Function rule /\b(#{mmsystem_parameters.join('|')})\b/, Name::Property rule /\b(#{mmjobs_functions.join('|')})\b/i, Name::Function rule /\b(#{mmjobs_parameters.join('|')})\b/, Name::Property rule id, Name end state :root do mixin :whitespace mixin :base end end end end rouge-2.2.1/lib/rouge/lexers/objective_c.rb0000644000175000017500000001157113150713277020476 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers load_lexer 'c.rb' class ObjectiveC < C tag 'objective_c' title "Objective-C" desc 'an extension of C commonly used to write Apple software' aliases 'objc' filenames '*.m', '*.h' mimetypes 'text/x-objective_c', 'application/x-objective_c' def self.at_keywords @at_keywords ||= %w( selector private protected public encode synchronized try throw catch finally end property synthesize dynamic optional interface implementation import ) end def self.at_builtins @at_builtins ||= %w(true false YES NO) end def self.builtins @builtins ||= %w(YES NO nil) end def self.analyze_text(text) return 1 if text =~ /@(end|implementation|protocol|property)\b/ id = /[a-z$_][a-z0-9$_]*/i return 0.4 if text =~ %r( \[ \s* #{id} \s+ (?: #{id} \s* \] | #{id}? : ) )x return 0.4 if text.include? '@"' end id = /[a-z$_][a-z0-9$_]*/i prepend :statements do rule /@"/, Str, :string rule /@'(\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|\\.|[^\\'\n]')/, Str::Char rule /@(\d+[.]\d*|[.]\d+|\d+)e[+-]?\d+l?/i, Num::Float rule /@(\d+[.]\d*|[.]\d+|\d+f)f?/i, Num::Float rule /@0x\h+[lL]?/, Num::Hex rule /@0[0-7]+l?/i, Num::Oct rule /@\d+l?/, Num::Integer rule /\bin\b/, Keyword rule /@(?:interface|implementation)\b/ do token Keyword goto :classname end rule /@(?:class|protocol)\b/ do token Keyword goto :forward_classname end rule /@([[:alnum:]]+)/ do |m| if self.class.at_keywords.include? m[1] token Keyword elsif self.class.at_builtins.include? m[1] token Name::Builtin else token Error end end rule /[?]/, Punctuation, :ternary rule /\[/, Punctuation, :message rule /@\[/, Punctuation, :array_literal rule /@\{/, Punctuation, :dictionary_literal end state :ternary do rule /:/, Punctuation, :pop! mixin :statements end state :message_shared do rule /\]/, Punctuation, :pop! rule /\{/, Punctuation, :pop! rule /;/, Error mixin :statement end state :message do rule /(#{id})(\s*)(:)/ do groups(Name::Function, Text, Punctuation) goto :message_with_args end rule /(#{id})(\s*)(\])/ do groups(Name::Function, Text, Punctuation) pop! end mixin :message_shared end state :message_with_args do rule /\{/, Punctuation, :function rule /(#{id})(\s*)(:)/ do groups(Name::Function, Text, Punctuation) pop! end mixin :message_shared end state :array_literal do rule /]/, Punctuation, :pop! rule /,/, Punctuation mixin :statements end state :dictionary_literal do rule /}/, Punctuation, :pop! rule /,/, Punctuation mixin :statements end state :classname do mixin :whitespace rule /(#{id})(\s*)(:)(\s*)(#{id})/ do groups(Name::Class, Text, Punctuation, Text, Name::Class) pop! end rule /(#{id})(\s*)([(])(\s*)(#{id})(\s*)([)])/ do groups(Name::Class, Text, Punctuation, Text, Name::Label, Text, Punctuation) pop! end rule id, Name::Class, :pop! end state :forward_classname do mixin :whitespace rule /(#{id})(\s*)(,)(\s*)/ do groups(Name::Class, Text, Punctuation, Text) push end rule /(#{id})(\s*)(;?)/ do groups(Name::Class, Text, Punctuation) pop! end end prepend :root do rule %r( ([-+])(\s*) ([(].*?[)])?(\s*) (?=#{id}:?) )ix do |m| token Keyword, m[1]; token Text, m[2] recurse m[3]; token Text, m[4] push :method_definition end end state :method_definition do rule /,/, Punctuation rule /[.][.][.]/, Punctuation rule /([(].*?[)])(#{id})/ do |m| recurse m[1]; token Name::Variable, m[2] end rule /(#{id})(\s*)(:)/m do groups(Name::Function, Text, Punctuation) end rule /;/, Punctuation, :pop! rule /{/ do token Punctuation goto :function end mixin :inline_whitespace rule %r(//.*?\n), Comment::Single rule /\s+/m, Text rule(//) { pop! } end end end end rouge-2.2.1/lib/rouge/lexers/sql.rb0000644000175000017500000001514313150713277017020 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class SQL < RegexLexer title "SQL" desc "Structured Query Language, for relational databases" tag 'sql' filenames '*.sql' mimetypes 'text/x-sql' def self.keywords @keywords ||= Set.new %w( ABORT ABS ABSOLUTE ACCESS ADA ADD ADMIN AFTER AGGREGATE ALIAS ALL ALLOCATE ALTER ANALYSE ANALYZE AND ANY ARE AS ASC ASENSITIVE ASSERTION ASSIGNMENT ASYMMETRIC AT ATOMIC AUTHORIZATION AVG BACKWARD BEFORE BEGIN BETWEEN BITVAR BIT_LENGTH BOTH BREADTH BY C CACHE CALL CALLED CARDINALITY CASCADE CASCADED CASE CAST CATALOG CATALOG_NAME CHAIN CHARACTERISTICS CHARACTER_LENGTH CHARACTER_SET_CATALOG CHARACTER_SET_NAME CHARACTER_SET_SCHEMA CHAR_LENGTH CHECK CHECKED CHECKPOINT CLASS CLASS_ORIGIN CLOB CLOSE CLUSTER COALSECE COBOL COLLATE COLLATION COLLATION_CATALOG COLLATION_NAME COLLATION_SCHEMA COLUMN COLUMN_NAME COMMAND_FUNCTION COMMAND_FUNCTION_CODE COMMENT COMMIT COMMITTED COMPLETION CONDITION_NUMBER CONNECT CONNECTION CONNECTION_NAME CONSTRAINT CONSTRAINTS CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA CONSTRUCTOR CONTAINS CONTINUE CONVERSION CONVERT COPY CORRESPONTING COUNT CREATE CREATEDB CREATEUSER CROSS CUBE CURRENT CURRENT_DATE CURRENT_PATH CURRENT_ROLE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR CURSOR_NAME CYCLE DATA DATABASE DATETIME_INTERVAL_CODE DATETIME_INTERVAL_PRECISION DAY DEALLOCATE DECLARE DEFAULT DEFAULTS DEFERRABLE DEFERRED DEFINED DEFINER DELETE DELIMITER DELIMITERS DEREF DESC DESCRIBE DESCRIPTOR DESTROY DESTRUCTOR DETERMINISTIC DIAGNOSTICS DICTIONARY DISCONNECT DISPATCH DISTINCT DO DOMAIN DROP DYNAMIC DYNAMIC_FUNCTION DYNAMIC_FUNCTION_CODE EACH ELSE ENCODING ENCRYPTED END END-EXEC EQUALS ESCAPE EVERY EXCEPT ESCEPTION EXCLUDING EXCLUSIVE EXEC EXECUTE EXISTING EXISTS EXPLAIN EXTERNAL EXTRACT FALSE FETCH FINAL FIRST FOR FORCE FOREIGN FORTRAN FORWARD FOUND FREE FREEZE FROM FULL FUNCTION G GENERAL GENERATED GET GLOBAL GO GOTO GRANT GRANTED GROUP GROUPING HANDLER HAVING HIERARCHY HOLD HOST IDENTITY IGNORE ILIKE IMMEDIATE IMMUTABLE IMPLEMENTATION IMPLICIT IN INCLUDING INCREMENT INDEX INDITCATOR INFIX INHERITS INITIALIZE INITIALLY INNER INOUT INPUT INSENSITIVE INSERT INSTANTIABLE INSTEAD INTERSECT INTO INVOKER IS ISNULL ISOLATION ITERATE JOIN KEY KEY_MEMBER KEY_TYPE LANCOMPILER LANGUAGE LARGE LAST LATERAL LEADING LEFT LENGTH LESS LEVEL LIKE LIMIT LISTEN LOAD LOCAL LOCALTIME LOCALTIMESTAMP LOCATION LOCATOR LOCK LOWER MAP MATCH MAX MAXVALUE MESSAGE_LENGTH MESSAGE_OCTET_LENGTH MESSAGE_TEXT METHOD MIN MINUTE MINVALUE MOD MODE MODIFIES MODIFY MONTH MORE MOVE MUMPS NAMES NATIONAL NATURAL NCHAR NCLOB NEW NEXT NO NOCREATEDB NOCREATEUSER NONE NOT NOTHING NOTIFY NOTNULL NULL NULLABLE NULLIF OBJECT OCTET_LENGTH OF OFF OFFSET OIDS OLD ON ONLY OPEN OPERATION OPERATOR OPTION OPTIONS OR ORDER ORDINALITY OUT OUTER OUTPUT OVERLAPS OVERLAY OVERRIDING OWNER PAD PARAMETER PARAMETERS PARAMETER_MODE PARAMATER_NAME PARAMATER_ORDINAL_POSITION PARAMETER_SPECIFIC_CATALOG PARAMETER_SPECIFIC_NAME PARAMATER_SPECIFIC_SCHEMA PARTIAL PASCAL PENDANT PLACING PLI POSITION POSTFIX PRECISION PREFIX PREORDER PREPARE PRESERVE PRIMARY PRIOR PRIVILEGES PROCEDURAL PROCEDURE PUBLIC READ READS RECHECK RECURSIVE REF REFERENCES REFERENCING REINDEX RELATIVE RENAME REPEATABLE REPLACE RESET RESTART RESTRICT RESULT RETURN RETURNED_LENGTH RETURNED_OCTET_LENGTH RETURNED_SQLSTATE RETURNS REVOKE RIGHT ROLE ROLLBACK ROLLUP ROUTINE ROUTINE_CATALOG ROUTINE_NAME ROUTINE_SCHEMA ROW ROWS ROW_COUNT RULE SAVE_POINT SCALE SCHEMA SCHEMA_NAME SCOPE SCROLL SEARCH SECOND SECURITY SELECT SELF SENSITIVE SERIALIZABLE SERVER_NAME SESSION SESSION_USER SET SETOF SETS SHARE SHOW SIMILAR SIMPLE SIZE SOME SOURCE SPACE SPECIFIC SPECIFICTYPE SPECIFIC_NAME SQL SQLCODE SQLERROR SQLEXCEPTION SQLSTATE SQLWARNINIG STABLE START STATE STATEMENT STATIC STATISTICS STDIN STDOUT STORAGE STRICT STRUCTURE STYPE SUBCLASS_ORIGIN SUBLIST SUBSTRING SUM SYMMETRIC SYSID SYSTEM SYSTEM_USER TABLE TABLE_NAME TEMP TEMPLATE TEMPORARY TERMINATE THAN THEN TIMESTAMP TIMEZONE_HOUR TIMEZONE_MINUTE TO TOAST TRAILING TRANSATION TRANSACTIONS_COMMITTED TRANSACTIONS_ROLLED_BACK TRANSATION_ACTIVE TRANSFORM TRANSFORMS TRANSLATE TRANSLATION TREAT TRIGGER TRIGGER_CATALOG TRIGGER_NAME TRIGGER_SCHEMA TRIM TRUE TRUNCATE TRUSTED TYPE UNCOMMITTED UNDER UNENCRYPTED UNION UNIQUE UNKNOWN UNLISTEN UNNAMED UNNEST UNTIL UPDATE UPPER USAGE USER USER_DEFINED_TYPE_CATALOG USER_DEFINED_TYPE_NAME USER_DEFINED_TYPE_SCHEMA USING VACUUM VALID VALIDATOR VALUES VARIABLE VERBOSE VERSION VIEW VOLATILE WHEN WHENEVER WHERE WITH WITHOUT WORK WRITE YEAR ZONE ) end state :root do rule /\s+/m, Text rule /--.*/, Comment::Single rule %r(/\*), Comment::Multiline, :multiline_comments rule /\d+/, Num::Integer rule /'/, Str::Single, :single_string rule /"/, Name::Variable, :double_string rule /`/, Name::Variable, :backtick rule /\w[\w\d]*/ do |m| if self.class.keywords.include? m[0].upcase token Keyword else token Name end end rule %r([+*/<>=~!@#%^&|?^-]), Operator rule /[;:()\[\],.]/, Punctuation end state :multiline_comments do rule %r(/[*]), Comment::Multiline, :multiline_comments rule %r([*]/), Comment::Multiline, :pop! rule %r([^/*]+), Comment::Multiline rule %r([/*]), Comment::Multiline end state :backtick do rule /\\./, Str::Escape rule /``/, Str::Escape rule /`/, Name::Variable, :pop! rule /[^\\`]+/, Name::Variable end state :single_string do rule /\\./, Str::Escape rule /''/, Str::Escape rule /'/, Str::Single, :pop! rule /[^\\']+/, Str::Single end state :double_string do rule /\\./, Str::Escape rule /""/, Str::Escape rule /"/, Name::Variable, :pop! rule /[^\\"]+/, Name::Variable end end end end rouge-2.2.1/lib/rouge/lexers/apiblueprint.rb0000644000175000017500000000246313150713277020720 0ustar uwabamiuwabamimodule Rouge module Lexers load_lexer 'markdown.rb' class APIBlueprint < Markdown title 'API Blueprint' desc 'Markdown based API description language.' tag 'apiblueprint' aliases 'apiblueprint', 'apib' filenames '*.apib' mimetypes 'text/vnd.apiblueprint' def self.analyze_text(text) return 1 if text.start_with?('FORMAT: 1A\n') end prepend :root do # Metadata rule(/(\S+)(:\s*)(.*)$/) do groups Name::Variable, Punctuation, Literal::String end # Resource Group rule(/^(#+)(\s*Group\s+)(.*)$/) do groups Punctuation, Keyword, Generic::Heading end # Resource \ Action rule(/^(#+)(.*)(\[.*\])$/) do groups Punctuation, Generic::Heading, Literal::String end # Relation rule(/^([\+\-\*])(\s*Relation:)(\s*.*)$/) do groups Punctuation, Keyword, Literal::String end # MSON rule(/^(\s+[\+\-\*]\s*)(Attributes|Parameters)(.*)$/) do groups Punctuation, Keyword, Literal::String end # Request/Response rule(/^([\+\-\*]\s*)(Request|Response)(\s+\d\d\d)?(.*)$/) do groups Punctuation, Keyword, Literal::Number, Literal::String end end end end end rouge-2.2.1/lib/rouge/lexers/nginx.rb0000644000175000017500000000271413150713277017344 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Nginx < RegexLexer title "nginx" desc 'configuration files for the nginx web server (nginx.org)' tag 'nginx' mimetypes 'text/x-nginx-conf' filenames 'nginx.conf' id = /[^\s$;{}()#]+/ state :root do rule /(include)(\s+)([^\s;]+)/ do groups Keyword, Text, Name end rule id, Keyword, :statement mixin :base end state :block do rule /}/, Punctuation, :pop! rule id, Keyword::Namespace, :statement mixin :base end state :statement do rule /{/ do token Punctuation; pop!; push :block end rule /;/, Punctuation, :pop! mixin :base end state :base do rule /\s+/, Text rule /#.*?\n/, Comment::Single rule /(?:on|off)\b/, Name::Constant rule /[$][\w-]+/, Name::Variable # host/port rule /([a-z0-9.-]+)(:)([0-9]+)/i do groups Name::Function, Punctuation, Num::Integer end # mimetype rule %r([a-z-]+/[a-z-]+)i, Name::Class rule /[0-9]+[kmg]?\b/i, Num::Integer rule /(~)(\s*)([^\s{]+)/ do groups Punctuation, Text, Str::Regex end rule /[:=~]/, Punctuation # pathname rule %r(/#{id}?), Name rule /[^#\s;{}$\\]+/, Str # catchall rule /[$;]/, Text end end end end rouge-2.2.1/lib/rouge/lexers/php/0000755000175000017500000000000013150713277016457 5ustar uwabamiuwabamirouge-2.2.1/lib/rouge/lexers/php/builtins.rb0000644000175000017500000025410013150713277020637 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # # automatically generated by `rake builtins:php` module Rouge module Lexers class PHP def self.builtins @builtins ||= {}.tap do |b| b["Apache"] = Set.new %w(apache_child_terminate apache_child_terminate apache_get_modules apache_get_version apache_getenv apache_lookup_uri apache_note apache_request_headers apache_reset_timeout apache_response_headers apache_setenv getallheaders virtual apache_child_terminate) b["APC"] = Set.new %w(apc_add apc_add apc_bin_dump apc_bin_dumpfile apc_bin_load apc_bin_loadfile apc_cache_info apc_cas apc_clear_cache apc_compile_file apc_dec apc_define_constants apc_delete_file apc_delete apc_exists apc_fetch apc_inc apc_load_constants apc_sma_info apc_store apc_add) b["APCu"] = Set.new %w(apcu_add apcu_add apcu_cache_info apcu_cas apcu_clear_cache apcu_dec apcu_delete apcu_entry apcu_exists apcu_fetch apcu_inc apcu_sma_info apcu_store apcu_add) b["APD"] = Set.new %w(apd_breakpoint apd_breakpoint apd_callstack apd_clunk apd_continue apd_croak apd_dump_function_table apd_dump_persistent_resources apd_dump_regular_resources apd_echo apd_get_active_symbols apd_set_pprof_trace apd_set_session_trace_socket apd_set_session_trace apd_set_session override_function rename_function apd_breakpoint) b["Array"] = Set.new %w(array_change_key_case array_change_key_case array_chunk array_column array_combine array_count_values array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_diff array_fill_keys array_fill array_filter array_flip array_intersect_assoc array_intersect_key array_intersect_uassoc array_intersect_ukey array_intersect array_key_exists array_keys array_map array_merge_recursive array_merge array_multisort array_pad array_pop array_product array_push array_rand array_reduce array_replace_recursive array_replace array_reverse array_search array_shift array_slice array_splice array_sum array_udiff_assoc array_udiff_uassoc array_udiff array_uintersect_assoc array_uintersect_uassoc array_uintersect array_unique array_unshift array_values array_walk_recursive array_walk array arsort asort compact count current each end extract in_array key_exists key krsort ksort list natcasesort natsort next pos prev range reset rsort shuffle sizeof sort uasort uksort usort array_change_key_case) b["BBCode"] = Set.new %w(bbcode_add_element bbcode_add_element bbcode_add_smiley bbcode_create bbcode_destroy bbcode_parse bbcode_set_arg_parser bbcode_set_flags bbcode_add_element) b["BC Math"] = Set.new %w(bcadd bcadd bccomp bcdiv bcmod bcmul bcpow bcpowmod bcscale bcsqrt bcsub bcadd) b["bcompiler"] = Set.new %w(bcompiler_load_exe bcompiler_load_exe bcompiler_load bcompiler_parse_class bcompiler_read bcompiler_write_class bcompiler_write_constant bcompiler_write_exe_footer bcompiler_write_file bcompiler_write_footer bcompiler_write_function bcompiler_write_functions_from_file bcompiler_write_header bcompiler_write_included_filename bcompiler_load_exe) b["Blenc"] = Set.new %w(blenc_encrypt blenc_encrypt blenc_encrypt) b["Bzip2"] = Set.new %w(bzclose bzclose bzcompress bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite bzclose) b["Cairo"] = Set.new %w(cairo_create cairo_create cairo_font_face_get_type cairo_font_face_status cairo_font_options_create cairo_font_options_equal cairo_font_options_get_antialias cairo_font_options_get_hint_metrics cairo_font_options_get_hint_style cairo_font_options_get_subpixel_order cairo_font_options_hash cairo_font_options_merge cairo_font_options_set_antialias cairo_font_options_set_hint_metrics cairo_font_options_set_hint_style cairo_font_options_set_subpixel_order cairo_font_options_status cairo_format_stride_for_width cairo_image_surface_create_for_data cairo_image_surface_create_from_png cairo_image_surface_create cairo_image_surface_get_data cairo_image_surface_get_format cairo_image_surface_get_height cairo_image_surface_get_stride cairo_image_surface_get_width cairo_matrix_create_scale cairo_matrix_create_translate cairo_matrix_invert cairo_matrix_multiply cairo_matrix_rotate cairo_matrix_transform_distance cairo_matrix_transform_point cairo_matrix_translate cairo_pattern_add_color_stop_rgb cairo_pattern_add_color_stop_rgba cairo_pattern_create_for_surface cairo_pattern_create_linear cairo_pattern_create_radial cairo_pattern_create_rgb cairo_pattern_create_rgba cairo_pattern_get_color_stop_count cairo_pattern_get_color_stop_rgba cairo_pattern_get_extend cairo_pattern_get_filter cairo_pattern_get_linear_points cairo_pattern_get_matrix cairo_pattern_get_radial_circles cairo_pattern_get_rgba cairo_pattern_get_surface cairo_pattern_get_type cairo_pattern_set_extend cairo_pattern_set_filter cairo_pattern_set_matrix cairo_pattern_status cairo_pdf_surface_create cairo_pdf_surface_set_size cairo_ps_get_levels cairo_ps_level_to_string cairo_ps_surface_create cairo_ps_surface_dsc_begin_page_setup cairo_ps_surface_dsc_begin_setup cairo_ps_surface_dsc_comment cairo_ps_surface_get_eps cairo_ps_surface_restrict_to_level cairo_ps_surface_set_eps cairo_ps_surface_set_size cairo_scaled_font_create cairo_scaled_font_extents cairo_scaled_font_get_ctm cairo_scaled_font_get_font_face cairo_scaled_font_get_font_matrix cairo_scaled_font_get_font_options cairo_scaled_font_get_scale_matrix cairo_scaled_font_get_type cairo_scaled_font_glyph_extents cairo_scaled_font_status cairo_scaled_font_text_extents cairo_surface_copy_page cairo_surface_create_similar cairo_surface_finish cairo_surface_flush cairo_surface_get_content cairo_surface_get_device_offset cairo_surface_get_font_options cairo_surface_get_type cairo_surface_mark_dirty_rectangle cairo_surface_mark_dirty cairo_surface_set_device_offset cairo_surface_set_fallback_resolution cairo_surface_show_page cairo_surface_status cairo_surface_write_to_png cairo_svg_surface_create cairo_svg_surface_restrict_to_version cairo_svg_version_to_string cairo_create) b["Calendar"] = Set.new %w(cal_days_in_month cal_days_in_month cal_from_jd cal_info cal_to_jd easter_date easter_days frenchtojd gregoriantojd jddayofweek jdmonthname jdtofrench jdtogregorian jdtojewish jdtojulian jdtounix jewishtojd juliantojd unixtojd cal_days_in_month) b["chdb"] = Set.new %w(chdb_create chdb_create chdb_create) b["Classkit"] = Set.new %w(classkit_import classkit_import classkit_method_add classkit_method_copy classkit_method_redefine classkit_method_remove classkit_method_rename classkit_import) b["Classes/Object"] = Set.new %w(__autoload __autoload call_user_method_array call_user_method class_alias class_exists get_called_class get_class_methods get_class_vars get_class get_declared_classes get_declared_interfaces get_declared_traits get_object_vars get_parent_class interface_exists is_a is_subclass_of method_exists property_exists trait_exists __autoload) b["COM"] = Set.new %w(com_create_guid com_create_guid com_event_sink com_get_active_object com_load_typelib com_message_pump com_print_typeinfo variant_abs variant_add variant_and variant_cast variant_cat variant_cmp variant_date_from_timestamp variant_date_to_timestamp variant_div variant_eqv variant_fix variant_get_type variant_idiv variant_imp variant_int variant_mod variant_mul variant_neg variant_not variant_or variant_pow variant_round variant_set_type variant_set variant_sub variant_xor com_create_guid) b["Crack"] = Set.new %w(crack_check crack_check crack_closedict crack_getlastmessage crack_opendict crack_check) b["CSPRNG"] = Set.new %w(random_bytes random_bytes random_int random_bytes) b["Ctype"] = Set.new %w(ctype_alnum ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_graph ctype_lower ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit ctype_alnum) b["CUBRID"] = Set.new %w(cubrid_bind cubrid_bind cubrid_close_prepare cubrid_close_request cubrid_col_get cubrid_col_size cubrid_column_names cubrid_column_types cubrid_commit cubrid_connect_with_url cubrid_connect cubrid_current_oid cubrid_disconnect cubrid_drop cubrid_error_code_facility cubrid_error_code cubrid_error_msg cubrid_execute cubrid_fetch cubrid_free_result cubrid_get_autocommit cubrid_get_charset cubrid_get_class_name cubrid_get_client_info cubrid_get_db_parameter cubrid_get_query_timeout cubrid_get_server_info cubrid_get cubrid_insert_id cubrid_is_instance cubrid_lob_close cubrid_lob_export cubrid_lob_get cubrid_lob_send cubrid_lob_size cubrid_lob2_bind cubrid_lob2_close cubrid_lob2_export cubrid_lob2_import cubrid_lob2_new cubrid_lob2_read cubrid_lob2_seek64 cubrid_lob2_seek cubrid_lob2_size64 cubrid_lob2_size cubrid_lob2_tell64 cubrid_lob2_tell cubrid_lob2_write cubrid_lock_read cubrid_lock_write cubrid_move_cursor cubrid_next_result cubrid_num_cols cubrid_num_rows cubrid_pconnect_with_url cubrid_pconnect cubrid_prepare cubrid_put cubrid_rollback cubrid_schema cubrid_seq_drop cubrid_seq_insert cubrid_seq_put cubrid_set_add cubrid_set_autocommit cubrid_set_db_parameter cubrid_set_drop cubrid_set_query_timeout cubrid_version cubrid_bind) b["cURL"] = Set.new %w(curl_close curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version curl_close) b["Cyrus"] = Set.new %w(cyrus_authenticate cyrus_authenticate cyrus_bind cyrus_close cyrus_connect cyrus_query cyrus_unbind cyrus_authenticate) b["Date/Time"] = Set.new %w(checkdate checkdate date_add date_create_from_format date_create_immutable_from_format date_create_immutable date_create date_date_set date_default_timezone_get date_default_timezone_set date_diff date_format date_get_last_errors date_interval_create_from_date_string date_interval_format date_isodate_set date_modify date_offset_get date_parse_from_format date_parse date_sub date_sun_info date_sunrise date_sunset date_time_set date_timestamp_get date_timestamp_set date_timezone_get date_timezone_set date getdate gettimeofday gmdate gmmktime gmstrftime idate localtime microtime mktime strftime strptime strtotime time timezone_abbreviations_list timezone_identifiers_list timezone_location_get timezone_name_from_abbr timezone_name_get timezone_offset_get timezone_open timezone_transitions_get timezone_version_get checkdate) b["DBA"] = Set.new %w(dba_close dba_close dba_delete dba_exists dba_fetch dba_firstkey dba_handlers dba_insert dba_key_split dba_list dba_nextkey dba_open dba_optimize dba_popen dba_replace dba_sync dba_close) b["dBase"] = Set.new %w(dbase_add_record dbase_add_record dbase_close dbase_create dbase_delete_record dbase_get_header_info dbase_get_record_with_names dbase_get_record dbase_numfields dbase_numrecords dbase_open dbase_pack dbase_replace_record dbase_add_record) b["DB++"] = Set.new %w(dbplus_add dbplus_add dbplus_aql dbplus_chdir dbplus_close dbplus_curr dbplus_errcode dbplus_errno dbplus_find dbplus_first dbplus_flush dbplus_freealllocks dbplus_freelock dbplus_freerlocks dbplus_getlock dbplus_getunique dbplus_info dbplus_last dbplus_lockrel dbplus_next dbplus_open dbplus_prev dbplus_rchperm dbplus_rcreate dbplus_rcrtexact dbplus_rcrtlike dbplus_resolve dbplus_restorepos dbplus_rkeys dbplus_ropen dbplus_rquery dbplus_rrename dbplus_rsecindex dbplus_runlink dbplus_rzap dbplus_savepos dbplus_setindex dbplus_setindexbynumber dbplus_sql dbplus_tcl dbplus_tremove dbplus_undo dbplus_undoprepare dbplus_unlockrel dbplus_unselect dbplus_update dbplus_xlockrel dbplus_xunlockrel dbplus_add) b["dbx"] = Set.new %w(dbx_close dbx_close dbx_compare dbx_connect dbx_error dbx_escape_string dbx_fetch_row dbx_query dbx_sort dbx_close) b["Direct IO"] = Set.new %w(dio_close dio_close dio_fcntl dio_open dio_read dio_seek dio_stat dio_tcsetattr dio_truncate dio_write dio_close) b["Directory"] = Set.new %w(chdir chdir chroot closedir dir getcwd opendir readdir rewinddir scandir chdir) b["DOM"] = Set.new %w(dom_import_simplexml dom_import_simplexml dom_import_simplexml) b["Eio"] = Set.new %w(eio_busy eio_busy eio_cancel eio_chmod eio_chown eio_close eio_custom eio_dup2 eio_event_loop eio_fallocate eio_fchmod eio_fchown eio_fdatasync eio_fstat eio_fstatvfs eio_fsync eio_ftruncate eio_futime eio_get_event_stream eio_get_last_error eio_grp_add eio_grp_cancel eio_grp_limit eio_grp eio_init eio_link eio_lstat eio_mkdir eio_mknod eio_nop eio_npending eio_nready eio_nreqs eio_nthreads eio_open eio_poll eio_read eio_readahead eio_readdir eio_readlink eio_realpath eio_rename eio_rmdir eio_seek eio_sendfile eio_set_max_idle eio_set_max_parallel eio_set_max_poll_reqs eio_set_max_poll_time eio_set_min_parallel eio_stat eio_statvfs eio_symlink eio_sync_file_range eio_sync eio_syncfs eio_truncate eio_unlink eio_utime eio_write eio_busy) b["Enchant"] = Set.new %w(enchant_broker_describe enchant_broker_describe enchant_broker_dict_exists enchant_broker_free_dict enchant_broker_free enchant_broker_get_dict_path enchant_broker_get_error enchant_broker_init enchant_broker_list_dicts enchant_broker_request_dict enchant_broker_request_pwl_dict enchant_broker_set_dict_path enchant_broker_set_ordering enchant_dict_add_to_personal enchant_dict_add_to_session enchant_dict_check enchant_dict_describe enchant_dict_get_error enchant_dict_is_in_session enchant_dict_quick_check enchant_dict_store_replacement enchant_dict_suggest enchant_broker_describe) b["Error Handling"] = Set.new %w(debug_backtrace debug_backtrace debug_print_backtrace error_clear_last error_get_last error_log error_reporting restore_error_handler restore_exception_handler set_error_handler set_exception_handler trigger_error user_error debug_backtrace) b["Program execution"] = Set.new %w(escapeshellarg escapeshellarg escapeshellcmd exec passthru proc_close proc_get_status proc_nice proc_open proc_terminate shell_exec system escapeshellarg) b["Exif"] = Set.new %w(exif_imagetype exif_imagetype exif_read_data exif_tagname exif_thumbnail read_exif_data exif_imagetype) b["Expect"] = Set.new %w(expect_expectl expect_expectl expect_popen expect_expectl) b["FAM"] = Set.new %w(fam_cancel_monitor fam_cancel_monitor fam_close fam_monitor_collection fam_monitor_directory fam_monitor_file fam_next_event fam_open fam_pending fam_resume_monitor fam_suspend_monitor fam_cancel_monitor) b["Fann"] = Set.new %w(fann_cascadetrain_on_data fann_cascadetrain_on_data fann_cascadetrain_on_file fann_clear_scaling_params fann_copy fann_create_from_file fann_create_shortcut_array fann_create_shortcut fann_create_sparse_array fann_create_sparse fann_create_standard_array fann_create_standard fann_create_train_from_callback fann_create_train fann_descale_input fann_descale_output fann_descale_train fann_destroy_train fann_destroy fann_duplicate_train_data fann_get_activation_function fann_get_activation_steepness fann_get_bias_array fann_get_bit_fail_limit fann_get_bit_fail fann_get_cascade_activation_functions_count fann_get_cascade_activation_functions fann_get_cascade_activation_steepnesses_count fann_get_cascade_activation_steepnesses fann_get_cascade_candidate_change_fraction fann_get_cascade_candidate_limit fann_get_cascade_candidate_stagnation_epochs fann_get_cascade_max_cand_epochs fann_get_cascade_max_out_epochs fann_get_cascade_min_cand_epochs fann_get_cascade_min_out_epochs fann_get_cascade_num_candidate_groups fann_get_cascade_num_candidates fann_get_cascade_output_change_fraction fann_get_cascade_output_stagnation_epochs fann_get_cascade_weight_multiplier fann_get_connection_array fann_get_connection_rate fann_get_errno fann_get_errstr fann_get_layer_array fann_get_learning_momentum fann_get_learning_rate fann_get_MSE fann_get_network_type fann_get_num_input fann_get_num_layers fann_get_num_output fann_get_quickprop_decay fann_get_quickprop_mu fann_get_rprop_decrease_factor fann_get_rprop_delta_max fann_get_rprop_delta_min fann_get_rprop_delta_zero fann_get_rprop_increase_factor fann_get_sarprop_step_error_shift fann_get_sarprop_step_error_threshold_factor fann_get_sarprop_temperature fann_get_sarprop_weight_decay_shift fann_get_total_connections fann_get_total_neurons fann_get_train_error_function fann_get_train_stop_function fann_get_training_algorithm fann_init_weights fann_length_train_data fann_merge_train_data fann_num_input_train_data fann_num_output_train_data fann_print_error fann_randomize_weights fann_read_train_from_file fann_reset_errno fann_reset_errstr fann_reset_MSE fann_run fann_save_train fann_save fann_scale_input_train_data fann_scale_input fann_scale_output_train_data fann_scale_output fann_scale_train_data fann_scale_train fann_set_activation_function_hidden fann_set_activation_function_layer fann_set_activation_function_output fann_set_activation_function fann_set_activation_steepness_hidden fann_set_activation_steepness_layer fann_set_activation_steepness_output fann_set_activation_steepness fann_set_bit_fail_limit fann_set_callback fann_set_cascade_activation_functions fann_set_cascade_activation_steepnesses fann_set_cascade_candidate_change_fraction fann_set_cascade_candidate_limit fann_set_cascade_candidate_stagnation_epochs fann_set_cascade_max_cand_epochs fann_set_cascade_max_out_epochs fann_set_cascade_min_cand_epochs fann_set_cascade_min_out_epochs fann_set_cascade_num_candidate_groups fann_set_cascade_output_change_fraction fann_set_cascade_output_stagnation_epochs fann_set_cascade_weight_multiplier fann_set_error_log fann_set_input_scaling_params fann_set_learning_momentum fann_set_learning_rate fann_set_output_scaling_params fann_set_quickprop_decay fann_set_quickprop_mu fann_set_rprop_decrease_factor fann_set_rprop_delta_max fann_set_rprop_delta_min fann_set_rprop_delta_zero fann_set_rprop_increase_factor fann_set_sarprop_step_error_shift fann_set_sarprop_step_error_threshold_factor fann_set_sarprop_temperature fann_set_sarprop_weight_decay_shift fann_set_scaling_params fann_set_train_error_function fann_set_train_stop_function fann_set_training_algorithm fann_set_weight_array fann_set_weight fann_shuffle_train_data fann_subset_train_data fann_test_data fann_test fann_train_epoch fann_train_on_data fann_train_on_file fann_train fann_cascadetrain_on_data) b["FrontBase"] = Set.new %w(fbsql_affected_rows fbsql_affected_rows fbsql_autocommit fbsql_blob_size fbsql_change_user fbsql_clob_size fbsql_close fbsql_commit fbsql_connect fbsql_create_blob fbsql_create_clob fbsql_create_db fbsql_data_seek fbsql_database_password fbsql_database fbsql_db_query fbsql_db_status fbsql_drop_db fbsql_errno fbsql_error fbsql_fetch_array fbsql_fetch_assoc fbsql_fetch_field fbsql_fetch_lengths fbsql_fetch_object fbsql_fetch_row fbsql_field_flags fbsql_field_len fbsql_field_name fbsql_field_seek fbsql_field_table fbsql_field_type fbsql_free_result fbsql_get_autostart_info fbsql_hostname fbsql_insert_id fbsql_list_dbs fbsql_list_fields fbsql_list_tables fbsql_next_result fbsql_num_fields fbsql_num_rows fbsql_password fbsql_pconnect fbsql_query fbsql_read_blob fbsql_read_clob fbsql_result fbsql_rollback fbsql_rows_fetched fbsql_select_db fbsql_set_characterset fbsql_set_lob_mode fbsql_set_password fbsql_set_transaction fbsql_start_db fbsql_stop_db fbsql_table_name fbsql_tablename fbsql_username fbsql_warnings fbsql_affected_rows) b["FDF"] = Set.new %w(fdf_add_doc_javascript fdf_add_doc_javascript fdf_add_template fdf_close fdf_create fdf_enum_values fdf_errno fdf_error fdf_get_ap fdf_get_attachment fdf_get_encoding fdf_get_file fdf_get_flags fdf_get_opt fdf_get_status fdf_get_value fdf_get_version fdf_header fdf_next_field_name fdf_open_string fdf_open fdf_remove_item fdf_save_string fdf_save fdf_set_ap fdf_set_encoding fdf_set_file fdf_set_flags fdf_set_javascript_action fdf_set_on_import_javascript fdf_set_opt fdf_set_status fdf_set_submit_form_action fdf_set_target_frame fdf_set_value fdf_set_version fdf_add_doc_javascript) b["Fileinfo"] = Set.new %w(finfo_buffer finfo_buffer finfo_close finfo_file finfo_open finfo_set_flags mime_content_type finfo_buffer) b["filePro"] = Set.new %w(filepro_fieldcount filepro_fieldcount filepro_fieldname filepro_fieldtype filepro_fieldwidth filepro_retrieve filepro_rowcount filepro filepro_fieldcount) b["Filesystem"] = Set.new %w(basename basename chgrp chmod chown clearstatcache copy delete dirname disk_free_space disk_total_space diskfreespace fclose feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents file fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype flock fnmatch fopen fpassthru fputcsv fputs fread fscanf fseek fstat ftell ftruncate fwrite glob is_dir is_executable is_file is_link is_readable is_uploaded_file is_writable is_writeable lchgrp lchown link linkinfo lstat mkdir move_uploaded_file parse_ini_file parse_ini_string pathinfo pclose popen readfile readlink realpath_cache_get realpath_cache_size realpath rename rewind rmdir set_file_buffer stat symlink tempnam tmpfile touch umask unlink basename) b["Filter"] = Set.new %w(filter_has_var filter_has_var filter_id filter_input_array filter_input filter_list filter_var_array filter_var filter_has_var) b["FPM"] = Set.new %w(fastcgi_finish_request fastcgi_finish_request fastcgi_finish_request) b["FriBiDi"] = Set.new %w(fribidi_log2vis fribidi_log2vis fribidi_log2vis) b["FTP"] = Set.new %w(ftp_alloc ftp_alloc ftp_cdup ftp_chdir ftp_chmod ftp_close ftp_connect ftp_delete ftp_exec ftp_fget ftp_fput ftp_get_option ftp_get ftp_login ftp_mdtm ftp_mkdir ftp_nb_continue ftp_nb_fget ftp_nb_fput ftp_nb_get ftp_nb_put ftp_nlist ftp_pasv ftp_put ftp_pwd ftp_quit ftp_raw ftp_rawlist ftp_rename ftp_rmdir ftp_set_option ftp_site ftp_size ftp_ssl_connect ftp_systype ftp_alloc) b["Function handling"] = Set.new %w(call_user_func_array call_user_func_array call_user_func create_function forward_static_call_array forward_static_call func_get_arg func_get_args func_num_args function_exists get_defined_functions register_shutdown_function register_tick_function unregister_tick_function call_user_func_array) b["GeoIP"] = Set.new %w(geoip_asnum_by_name geoip_asnum_by_name geoip_continent_code_by_name geoip_country_code_by_name geoip_country_code3_by_name geoip_country_name_by_name geoip_database_info geoip_db_avail geoip_db_filename geoip_db_get_all_info geoip_domain_by_name geoip_id_by_name geoip_isp_by_name geoip_netspeedcell_by_name geoip_org_by_name geoip_record_by_name geoip_region_by_name geoip_region_name_by_code geoip_setup_custom_directory geoip_time_zone_by_country_and_region geoip_asnum_by_name) b["Gettext"] = Set.new %w(bind_textdomain_codeset bind_textdomain_codeset bindtextdomain dcgettext dcngettext dgettext dngettext gettext ngettext textdomain bind_textdomain_codeset) b["GMP"] = Set.new %w(gmp_abs gmp_abs gmp_add gmp_and gmp_clrbit gmp_cmp gmp_com gmp_div_q gmp_div_qr gmp_div_r gmp_div gmp_divexact gmp_export gmp_fact gmp_gcd gmp_gcdext gmp_hamdist gmp_import gmp_init gmp_intval gmp_invert gmp_jacobi gmp_legendre gmp_mod gmp_mul gmp_neg gmp_nextprime gmp_or gmp_perfect_square gmp_popcount gmp_pow gmp_powm gmp_prob_prime gmp_random_bits gmp_random_range gmp_random_seed gmp_random gmp_root gmp_rootrem gmp_scan0 gmp_scan1 gmp_setbit gmp_sign gmp_sqrt gmp_sqrtrem gmp_strval gmp_sub gmp_testbit gmp_xor gmp_abs) b["GnuPG"] = Set.new %w(gnupg_adddecryptkey gnupg_adddecryptkey gnupg_addencryptkey gnupg_addsignkey gnupg_cleardecryptkeys gnupg_clearencryptkeys gnupg_clearsignkeys gnupg_decrypt gnupg_decryptverify gnupg_encrypt gnupg_encryptsign gnupg_export gnupg_geterror gnupg_getprotocol gnupg_import gnupg_init gnupg_keyinfo gnupg_setarmor gnupg_seterrormode gnupg_setsignmode gnupg_sign gnupg_verify gnupg_adddecryptkey) b["Gupnp"] = Set.new %w(gupnp_context_get_host_ip gupnp_context_get_host_ip gupnp_context_get_port gupnp_context_get_subscription_timeout gupnp_context_host_path gupnp_context_new gupnp_context_set_subscription_timeout gupnp_context_timeout_add gupnp_context_unhost_path gupnp_control_point_browse_start gupnp_control_point_browse_stop gupnp_control_point_callback_set gupnp_control_point_new gupnp_device_action_callback_set gupnp_device_info_get_service gupnp_device_info_get gupnp_root_device_get_available gupnp_root_device_get_relative_location gupnp_root_device_new gupnp_root_device_set_available gupnp_root_device_start gupnp_root_device_stop gupnp_service_action_get gupnp_service_action_return_error gupnp_service_action_return gupnp_service_action_set gupnp_service_freeze_notify gupnp_service_info_get_introspection gupnp_service_info_get gupnp_service_introspection_get_state_variable gupnp_service_notify gupnp_service_proxy_action_get gupnp_service_proxy_action_set gupnp_service_proxy_add_notify gupnp_service_proxy_callback_set gupnp_service_proxy_get_subscribed gupnp_service_proxy_remove_notify gupnp_service_proxy_set_subscribed gupnp_service_thaw_notify gupnp_context_get_host_ip) b["Hash"] = Set.new %w(hash_algos hash_algos hash_copy hash_equals hash_file hash_final hash_hkdf hash_hmac_file hash_hmac hash_init hash_pbkdf2 hash_update_file hash_update_stream hash_update hash hash_algos) b["Hyperwave API"] = Set.new %w(hwapi_attribute_new hwapi_content_new hwapi_hgcsp hwapi_object_new) b["Firebird/InterBase"] = Set.new %w(ibase_add_user ibase_add_user ibase_affected_rows ibase_backup ibase_blob_add ibase_blob_cancel ibase_blob_close ibase_blob_create ibase_blob_echo ibase_blob_get ibase_blob_import ibase_blob_info ibase_blob_open ibase_close ibase_commit_ret ibase_commit ibase_connect ibase_db_info ibase_delete_user ibase_drop_db ibase_errcode ibase_errmsg ibase_execute ibase_fetch_assoc ibase_fetch_object ibase_fetch_row ibase_field_info ibase_free_event_handler ibase_free_query ibase_free_result ibase_gen_id ibase_maintain_db ibase_modify_user ibase_name_result ibase_num_fields ibase_num_params ibase_param_info ibase_pconnect ibase_prepare ibase_query ibase_restore ibase_rollback_ret ibase_rollback ibase_server_info ibase_service_attach ibase_service_detach ibase_set_event_handler ibase_trans ibase_wait_event ibase_add_user) b["IBM DB2"] = Set.new %w(db2_autocommit db2_autocommit db2_bind_param db2_client_info db2_close db2_column_privileges db2_columns db2_commit db2_conn_error db2_conn_errormsg db2_connect db2_cursor_type db2_escape_string db2_exec db2_execute db2_fetch_array db2_fetch_assoc db2_fetch_both db2_fetch_object db2_fetch_row db2_field_display_size db2_field_name db2_field_num db2_field_precision db2_field_scale db2_field_type db2_field_width db2_foreign_keys db2_free_result db2_free_stmt db2_get_option db2_last_insert_id db2_lob_read db2_next_result db2_num_fields db2_num_rows db2_pclose db2_pconnect db2_prepare db2_primary_keys db2_procedure_columns db2_procedures db2_result db2_rollback db2_server_info db2_set_option db2_special_columns db2_statistics db2_stmt_error db2_stmt_errormsg db2_table_privileges db2_tables db2_autocommit) b["iconv"] = Set.new %w(iconv_get_encoding iconv_get_encoding iconv_mime_decode_headers iconv_mime_decode iconv_mime_encode iconv_set_encoding iconv_strlen iconv_strpos iconv_strrpos iconv_substr iconv ob_iconv_handler iconv_get_encoding) b["ID3"] = Set.new %w(id3_get_frame_long_name id3_get_frame_long_name id3_get_frame_short_name id3_get_genre_id id3_get_genre_list id3_get_genre_name id3_get_tag id3_get_version id3_remove_tag id3_set_tag id3_get_frame_long_name) b["Informix"] = Set.new %w(ifx_affected_rows ifx_affected_rows ifx_blobinfile_mode ifx_byteasvarchar ifx_close ifx_connect ifx_copy_blob ifx_create_blob ifx_create_char ifx_do ifx_error ifx_errormsg ifx_fetch_row ifx_fieldproperties ifx_fieldtypes ifx_free_blob ifx_free_char ifx_free_result ifx_get_blob ifx_get_char ifx_getsqlca ifx_htmltbl_result ifx_nullformat ifx_num_fields ifx_num_rows ifx_pconnect ifx_prepare ifx_query ifx_textasvarchar ifx_update_blob ifx_update_char ifxus_close_slob ifxus_create_slob ifxus_free_slob ifxus_open_slob ifxus_read_slob ifxus_seek_slob ifxus_tell_slob ifxus_write_slob ifx_affected_rows) b["IIS"] = Set.new %w(iis_add_server iis_add_server iis_get_dir_security iis_get_script_map iis_get_server_by_comment iis_get_server_by_path iis_get_server_rights iis_get_service_state iis_remove_server iis_set_app_settings iis_set_dir_security iis_set_script_map iis_set_server_rights iis_start_server iis_start_service iis_stop_server iis_stop_service iis_add_server) b["GD and Image"] = Set.new %w(gd_info gd_info getimagesize getimagesizefromstring image_type_to_extension image_type_to_mime_type image2wbmp imageaffine imageaffinematrixconcat imageaffinematrixget imagealphablending imageantialias imagearc imagebmp imagechar imagecharup imagecolorallocate imagecolorallocatealpha imagecolorat imagecolorclosest imagecolorclosestalpha imagecolorclosesthwb imagecolordeallocate imagecolorexact imagecolorexactalpha imagecolormatch imagecolorresolve imagecolorresolvealpha imagecolorset imagecolorsforindex imagecolorstotal imagecolortransparent imageconvolution imagecopy imagecopymerge imagecopymergegray imagecopyresampled imagecopyresized imagecreate imagecreatefrombmp imagecreatefromgd2 imagecreatefromgd2part imagecreatefromgd imagecreatefromgif imagecreatefromjpeg imagecreatefrompng imagecreatefromstring imagecreatefromwbmp imagecreatefromwebp imagecreatefromxbm imagecreatefromxpm imagecreatetruecolor imagecrop imagecropauto imagedashedline imagedestroy imageellipse imagefill imagefilledarc imagefilledellipse imagefilledpolygon imagefilledrectangle imagefilltoborder imagefilter imageflip imagefontheight imagefontwidth imageftbbox imagefttext imagegammacorrect imagegd2 imagegd imagegetclip imagegif imagegrabscreen imagegrabwindow imageinterlace imageistruecolor imagejpeg imagelayereffect imageline imageloadfont imageopenpolygon imagepalettecopy imagepalettetotruecolor imagepng imagepolygon imagepsbbox imagepsencodefont imagepsextendfont imagepsfreefont imagepsloadfont imagepsslantfont imagepstext imagerectangle imageresolution imagerotate imagesavealpha imagescale imagesetbrush imagesetclip imagesetinterpolation imagesetpixel imagesetstyle imagesetthickness imagesettile imagestring imagestringup imagesx imagesy imagetruecolortopalette imagettfbbox imagettftext imagetypes imagewbmp imagewebp imagexbm iptcembed iptcparse jpeg2wbmp png2wbmp gd_info) b["IMAP"] = Set.new %w(imap_8bit imap_8bit imap_alerts imap_append imap_base64 imap_binary imap_body imap_bodystruct imap_check imap_clearflag_full imap_close imap_create imap_createmailbox imap_delete imap_deletemailbox imap_errors imap_expunge imap_fetch_overview imap_fetchbody imap_fetchheader imap_fetchmime imap_fetchstructure imap_fetchtext imap_gc imap_get_quota imap_get_quotaroot imap_getacl imap_getmailboxes imap_getsubscribed imap_header imap_headerinfo imap_headers imap_last_error imap_list imap_listmailbox imap_listscan imap_listsubscribed imap_lsub imap_mail_compose imap_mail_copy imap_mail_move imap_mail imap_mailboxmsginfo imap_mime_header_decode imap_msgno imap_num_msg imap_num_recent imap_open imap_ping imap_qprint imap_rename imap_renamemailbox imap_reopen imap_rfc822_parse_adrlist imap_rfc822_parse_headers imap_rfc822_write_address imap_savebody imap_scan imap_scanmailbox imap_search imap_set_quota imap_setacl imap_setflag_full imap_sort imap_status imap_subscribe imap_thread imap_timeout imap_uid imap_undelete imap_unsubscribe imap_utf7_decode imap_utf7_encode imap_utf8 imap_8bit) b["inclued"] = Set.new %w(inclued_get_data inclued_get_data inclued_get_data) b["PHP Options/Info"] = Set.new %w(assert_options assert_options assert cli_get_process_title cli_set_process_title dl extension_loaded gc_collect_cycles gc_disable gc_enable gc_enabled gc_mem_caches get_cfg_var get_current_user get_defined_constants get_extension_funcs get_include_path get_included_files get_loaded_extensions get_magic_quotes_gpc get_magic_quotes_runtime get_required_files get_resources getenv getlastmod getmygid getmyinode getmypid getmyuid getopt getrusage ini_alter ini_get_all ini_get ini_restore ini_set magic_quotes_runtime main memory_get_peak_usage memory_get_usage php_ini_loaded_file php_ini_scanned_files php_logo_guid php_sapi_name php_uname phpcredits phpinfo phpversion putenv restore_include_path set_include_path set_magic_quotes_runtime set_time_limit sys_get_temp_dir version_compare zend_logo_guid zend_thread_id zend_version assert_options) b["Ingres"] = Set.new %w(ingres_autocommit_state ingres_autocommit_state ingres_autocommit ingres_charset ingres_close ingres_commit ingres_connect ingres_cursor ingres_errno ingres_error ingres_errsqlstate ingres_escape_string ingres_execute ingres_fetch_array ingres_fetch_assoc ingres_fetch_object ingres_fetch_proc_return ingres_fetch_row ingres_field_length ingres_field_name ingres_field_nullable ingres_field_precision ingres_field_scale ingres_field_type ingres_free_result ingres_next_error ingres_num_fields ingres_num_rows ingres_pconnect ingres_prepare ingres_query ingres_result_seek ingres_rollback ingres_set_environment ingres_unbuffered_query ingres_autocommit_state) b["Inotify"] = Set.new %w(inotify_add_watch inotify_add_watch inotify_init inotify_queue_len inotify_read inotify_rm_watch inotify_add_watch) b["Grapheme"] = Set.new %w(grapheme_extract grapheme_extract grapheme_stripos grapheme_stristr grapheme_strlen grapheme_strpos grapheme_strripos grapheme_strrpos grapheme_strstr grapheme_substr grapheme_extract) b["intl"] = Set.new %w(intl_error_name intl_error_name intl_get_error_code intl_get_error_message intl_is_failure intl_error_name) b["IDN"] = Set.new %w(grapheme_substr idn_to_ascii idn_to_ascii idn_to_utf8 grapheme_substr idn_to_ascii) b["JSON"] = Set.new %w(json_decode json_decode json_encode json_last_error_msg json_last_error json_decode) b["Judy"] = Set.new %w(judy_type judy_type judy_version judy_type) b["KADM5"] = Set.new %w(kadm5_chpass_principal kadm5_chpass_principal kadm5_create_principal kadm5_delete_principal kadm5_destroy kadm5_flush kadm5_get_policies kadm5_get_principal kadm5_get_principals kadm5_init_with_password kadm5_modify_principal kadm5_chpass_principal) b["LDAP"] = Set.new %w(ldap_8859_to_t61 ldap_8859_to_t61 ldap_add ldap_bind ldap_close ldap_compare ldap_connect ldap_control_paged_result_response ldap_control_paged_result ldap_count_entries ldap_delete ldap_dn2ufn ldap_err2str ldap_errno ldap_error ldap_escape ldap_explode_dn ldap_first_attribute ldap_first_entry ldap_first_reference ldap_free_result ldap_get_attributes ldap_get_dn ldap_get_entries ldap_get_option ldap_get_values_len ldap_get_values ldap_list ldap_mod_add ldap_mod_del ldap_mod_replace ldap_modify_batch ldap_modify ldap_next_attribute ldap_next_entry ldap_next_reference ldap_parse_reference ldap_parse_result ldap_read ldap_rename ldap_sasl_bind ldap_search ldap_set_option ldap_set_rebind_proc ldap_sort ldap_start_tls ldap_t61_to_8859 ldap_unbind ldap_8859_to_t61) b["Libevent"] = Set.new %w(event_add event_add event_base_free event_base_loop event_base_loopbreak event_base_loopexit event_base_new event_base_priority_init event_base_reinit event_base_set event_buffer_base_set event_buffer_disable event_buffer_enable event_buffer_fd_set event_buffer_free event_buffer_new event_buffer_priority_set event_buffer_read event_buffer_set_callback event_buffer_timeout_set event_buffer_watermark_set event_buffer_write event_del event_free event_new event_priority_set event_set event_timer_add event_timer_del event_timer_new event_timer_set event_add) b["libxml"] = Set.new %w(libxml_clear_errors libxml_clear_errors libxml_disable_entity_loader libxml_get_errors libxml_get_last_error libxml_set_external_entity_loader libxml_set_streams_context libxml_use_internal_errors libxml_clear_errors) b["LZF"] = Set.new %w(lzf_compress lzf_compress lzf_decompress lzf_optimized_for lzf_compress) b["Mail"] = Set.new %w(ezmlm_hash ezmlm_hash mail ezmlm_hash) b["Mailparse"] = Set.new %w(mailparse_determine_best_xfer_encoding mailparse_determine_best_xfer_encoding mailparse_msg_create mailparse_msg_extract_part_file mailparse_msg_extract_part mailparse_msg_extract_whole_part_file mailparse_msg_free mailparse_msg_get_part_data mailparse_msg_get_part mailparse_msg_get_structure mailparse_msg_parse_file mailparse_msg_parse mailparse_rfc822_parse_addresses mailparse_stream_encode mailparse_uudecode_all mailparse_determine_best_xfer_encoding) b["Math"] = Set.new %w(abs abs acos acosh asin asinh atan2 atan atanh base_convert bindec ceil cos cosh decbin dechex decoct deg2rad exp expm1 floor fmod getrandmax hexdec hypot intdiv is_finite is_infinite is_nan lcg_value log10 log1p log max min mt_getrandmax mt_rand mt_srand octdec pi pow rad2deg rand round sin sinh sqrt srand tan tanh abs) b["MaxDB"] = Set.new %w(maxdb_affected_rows maxdb_affected_rows maxdb_autocommit maxdb_bind_param maxdb_bind_result maxdb_change_user maxdb_character_set_name maxdb_client_encoding maxdb_close_long_data maxdb_close maxdb_commit maxdb_connect_errno maxdb_connect_error maxdb_connect maxdb_data_seek maxdb_debug maxdb_disable_reads_from_master maxdb_disable_rpl_parse maxdb_dump_debug_info maxdb_embedded_connect maxdb_enable_reads_from_master maxdb_enable_rpl_parse maxdb_errno maxdb_error maxdb_escape_string maxdb_execute maxdb_fetch_array maxdb_fetch_assoc maxdb_fetch_field_direct maxdb_fetch_field maxdb_fetch_fields maxdb_fetch_lengths maxdb_fetch_object maxdb_fetch_row maxdb_fetch maxdb_field_count maxdb_field_seek maxdb_field_tell maxdb_free_result maxdb_get_client_info maxdb_get_client_version maxdb_get_host_info maxdb_get_metadata maxdb_get_proto_info maxdb_get_server_info maxdb_get_server_version maxdb_info maxdb_init maxdb_insert_id maxdb_kill maxdb_master_query maxdb_more_results maxdb_multi_query maxdb_next_result maxdb_num_fields maxdb_num_rows maxdb_options maxdb_param_count maxdb_ping maxdb_prepare maxdb_query maxdb_real_connect maxdb_real_escape_string maxdb_real_query maxdb_report maxdb_rollback maxdb_rpl_parse_enabled maxdb_rpl_probe maxdb_rpl_query_type maxdb_select_db maxdb_send_long_data maxdb_send_query maxdb_server_end maxdb_server_init maxdb_set_opt maxdb_sqlstate maxdb_ssl_set maxdb_stat maxdb_stmt_affected_rows maxdb_stmt_bind_param maxdb_stmt_bind_result maxdb_stmt_close_long_data maxdb_stmt_close maxdb_stmt_data_seek maxdb_stmt_errno maxdb_stmt_error maxdb_stmt_execute maxdb_stmt_fetch maxdb_stmt_free_result maxdb_stmt_init maxdb_stmt_num_rows maxdb_stmt_param_count maxdb_stmt_prepare maxdb_stmt_reset maxdb_stmt_result_metadata maxdb_stmt_send_long_data maxdb_stmt_sqlstate maxdb_stmt_store_result maxdb_store_result maxdb_thread_id maxdb_thread_safe maxdb_use_result maxdb_warning_count maxdb_affected_rows) b["Multibyte String"] = Set.new %w(mb_check_encoding mb_check_encoding mb_convert_case mb_convert_encoding mb_convert_kana mb_convert_variables mb_decode_mimeheader mb_decode_numericentity mb_detect_encoding mb_detect_order mb_encode_mimeheader mb_encode_numericentity mb_encoding_aliases mb_ereg_match mb_ereg_replace_callback mb_ereg_replace mb_ereg_search_getpos mb_ereg_search_getregs mb_ereg_search_init mb_ereg_search_pos mb_ereg_search_regs mb_ereg_search_setpos mb_ereg_search mb_ereg mb_eregi_replace mb_eregi mb_get_info mb_http_input mb_http_output mb_internal_encoding mb_language mb_list_encodings mb_output_handler mb_parse_str mb_preferred_mime_name mb_regex_encoding mb_regex_set_options mb_send_mail mb_split mb_strcut mb_strimwidth mb_stripos mb_stristr mb_strlen mb_strpos mb_strrchr mb_strrichr mb_strripos mb_strrpos mb_strstr mb_strtolower mb_strtoupper mb_strwidth mb_substitute_character mb_substr_count mb_substr mb_check_encoding) b["Mcrypt"] = Set.new %w(mcrypt_cbc mcrypt_cbc mcrypt_cfb mcrypt_create_iv mcrypt_decrypt mcrypt_ecb mcrypt_enc_get_algorithms_name mcrypt_enc_get_block_size mcrypt_enc_get_iv_size mcrypt_enc_get_key_size mcrypt_enc_get_modes_name mcrypt_enc_get_supported_key_sizes mcrypt_enc_is_block_algorithm_mode mcrypt_enc_is_block_algorithm mcrypt_enc_is_block_mode mcrypt_enc_self_test mcrypt_encrypt mcrypt_generic_deinit mcrypt_generic_end mcrypt_generic_init mcrypt_generic mcrypt_get_block_size mcrypt_get_cipher_name mcrypt_get_iv_size mcrypt_get_key_size mcrypt_list_algorithms mcrypt_list_modes mcrypt_module_close mcrypt_module_get_algo_block_size mcrypt_module_get_algo_key_size mcrypt_module_get_supported_key_sizes mcrypt_module_is_block_algorithm_mode mcrypt_module_is_block_algorithm mcrypt_module_is_block_mode mcrypt_module_open mcrypt_module_self_test mcrypt_ofb mdecrypt_generic mcrypt_cbc) b["MCVE"] = Set.new %w(m_checkstatus m_checkstatus m_completeauthorizations m_connect m_connectionerror m_deletetrans m_destroyconn m_destroyengine m_getcell m_getcellbynum m_getcommadelimited m_getheader m_initconn m_initengine m_iscommadelimited m_maxconntimeout m_monitor m_numcolumns m_numrows m_parsecommadelimited m_responsekeys m_responseparam m_returnstatus m_setblocking m_setdropfile m_setip m_setssl_cafile m_setssl_files m_setssl m_settimeout m_sslcert_gen_hash m_transactionssent m_transinqueue m_transkeyval m_transnew m_transsend m_uwait m_validateidentifier m_verifyconnection m_verifysslcert m_checkstatus) b["Memcache"] = Set.new %w(memcache_debug memcache_debug memcache_debug) b["Mhash"] = Set.new %w(mhash_count mhash_count mhash_get_block_size mhash_get_hash_name mhash_keygen_s2k mhash mhash_count) b["Ming"] = Set.new %w(ming_keypress ming_keypress ming_setcubicthreshold ming_setscale ming_setswfcompression ming_useconstants ming_useswfversion ming_keypress) b["Misc."] = Set.new %w(connection_aborted connection_aborted connection_status constant define defined die eval exit get_browser __halt_compiler highlight_file highlight_string ignore_user_abort pack php_check_syntax php_strip_whitespace show_source sleep sys_getloadavg time_nanosleep time_sleep_until uniqid unpack usleep connection_aborted) b["mnoGoSearch"] = Set.new %w(udm_add_search_limit udm_add_search_limit udm_alloc_agent_array udm_alloc_agent udm_api_version udm_cat_list udm_cat_path udm_check_charset udm_clear_search_limits udm_crc32 udm_errno udm_error udm_find udm_free_agent udm_free_ispell_data udm_free_res udm_get_doc_count udm_get_res_field udm_get_res_param udm_hash32 udm_load_ispell_data udm_set_agent_param udm_add_search_limit) b["Mongo"] = Set.new %w(bson_decode bson_decode bson_encode bson_decode) b["mqseries"] = Set.new %w(mqseries_back mqseries_back mqseries_begin mqseries_close mqseries_cmit mqseries_conn mqseries_connx mqseries_disc mqseries_get mqseries_inq mqseries_open mqseries_put1 mqseries_put mqseries_set mqseries_strerror mqseries_back) b["Msession"] = Set.new %w(msession_connect msession_connect msession_count msession_create msession_destroy msession_disconnect msession_find msession_get_array msession_get_data msession_get msession_inc msession_list msession_listvar msession_lock msession_plugin msession_randstr msession_set_array msession_set_data msession_set msession_timeout msession_uniq msession_unlock msession_connect) b["mSQL"] = Set.new %w(msql_affected_rows msql_affected_rows msql_close msql_connect msql_create_db msql_createdb msql_data_seek msql_db_query msql_dbname msql_drop_db msql_error msql_fetch_array msql_fetch_field msql_fetch_object msql_fetch_row msql_field_flags msql_field_len msql_field_name msql_field_seek msql_field_table msql_field_type msql_fieldflags msql_fieldlen msql_fieldname msql_fieldtable msql_fieldtype msql_free_result msql_list_dbs msql_list_fields msql_list_tables msql_num_fields msql_num_rows msql_numfields msql_numrows msql_pconnect msql_query msql_regcase msql_result msql_select_db msql_tablename msql msql_affected_rows) b["Mssql"] = Set.new %w(mssql_bind mssql_bind mssql_close mssql_connect mssql_data_seek mssql_execute mssql_fetch_array mssql_fetch_assoc mssql_fetch_batch mssql_fetch_field mssql_fetch_object mssql_fetch_row mssql_field_length mssql_field_name mssql_field_seek mssql_field_type mssql_free_result mssql_free_statement mssql_get_last_message mssql_guid_string mssql_init mssql_min_error_severity mssql_min_message_severity mssql_next_result mssql_num_fields mssql_num_rows mssql_pconnect mssql_query mssql_result mssql_rows_affected mssql_select_db mssql_bind) b["MySQL"] = Set.new %w(mysql_affected_rows mysql_affected_rows mysql_client_encoding mysql_close mysql_connect mysql_create_db mysql_data_seek mysql_db_name mysql_db_query mysql_drop_db mysql_errno mysql_error mysql_escape_string mysql_fetch_array mysql_fetch_assoc mysql_fetch_field mysql_fetch_lengths mysql_fetch_object mysql_fetch_row mysql_field_flags mysql_field_len mysql_field_name mysql_field_seek mysql_field_table mysql_field_type mysql_free_result mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql_insert_id mysql_list_dbs mysql_list_fields mysql_list_processes mysql_list_tables mysql_num_fields mysql_num_rows mysql_pconnect mysql_ping mysql_query mysql_real_escape_string mysql_result mysql_select_db mysql_set_charset mysql_stat mysql_tablename mysql_thread_id mysql_unbuffered_query mysql_affected_rows) b["Aliases and deprecated Mysqli"] = Set.new %w(mysqli_bind_param mysqli_bind_param mysqli_bind_result mysqli_client_encoding mysqli_connect mysqli::disable_reads_from_master mysqli_disable_rpl_parse mysqli_enable_reads_from_master mysqli_enable_rpl_parse mysqli_escape_string mysqli_execute mysqli_fetch mysqli_get_cache_stats mysqli_get_links_stats mysqli_get_metadata mysqli_master_query mysqli_param_count mysqli_report mysqli_rpl_parse_enabled mysqli_rpl_probe mysqli_send_long_data mysqli::set_opt mysqli_slave_query mysqli_bind_param) b["Mysqlnd_memcache"] = Set.new %w(mysqlnd_memcache_get_config mysqlnd_memcache_get_config mysqlnd_memcache_set mysqlnd_memcache_get_config) b["Mysqlnd_ms"] = Set.new %w(mysqlnd_ms_dump_servers mysqlnd_ms_dump_servers mysqlnd_ms_fabric_select_global mysqlnd_ms_fabric_select_shard mysqlnd_ms_get_last_gtid mysqlnd_ms_get_last_used_connection mysqlnd_ms_get_stats mysqlnd_ms_match_wild mysqlnd_ms_query_is_select mysqlnd_ms_set_qos mysqlnd_ms_set_user_pick_server mysqlnd_ms_xa_begin mysqlnd_ms_xa_commit mysqlnd_ms_xa_gc mysqlnd_ms_xa_rollback mysqlnd_ms_dump_servers) b["mysqlnd_qc"] = Set.new %w(mysqlnd_qc_clear_cache mysqlnd_qc_clear_cache mysqlnd_qc_get_available_handlers mysqlnd_qc_get_cache_info mysqlnd_qc_get_core_stats mysqlnd_qc_get_normalized_query_trace_log mysqlnd_qc_get_query_trace_log mysqlnd_qc_set_cache_condition mysqlnd_qc_set_is_select mysqlnd_qc_set_storage_handler mysqlnd_qc_set_user_handlers mysqlnd_qc_clear_cache) b["Mysqlnd_uh"] = Set.new %w(mysqlnd_uh_convert_to_mysqlnd mysqlnd_uh_convert_to_mysqlnd mysqlnd_uh_set_connection_proxy mysqlnd_uh_set_statement_proxy mysqlnd_uh_convert_to_mysqlnd) b["Ncurses"] = Set.new %w(ncurses_addch ncurses_addch ncurses_addchnstr ncurses_addchstr ncurses_addnstr ncurses_addstr ncurses_assume_default_colors ncurses_attroff ncurses_attron ncurses_attrset ncurses_baudrate ncurses_beep ncurses_bkgd ncurses_bkgdset ncurses_border ncurses_bottom_panel ncurses_can_change_color ncurses_cbreak ncurses_clear ncurses_clrtobot ncurses_clrtoeol ncurses_color_content ncurses_color_set ncurses_curs_set ncurses_def_prog_mode ncurses_def_shell_mode ncurses_define_key ncurses_del_panel ncurses_delay_output ncurses_delch ncurses_deleteln ncurses_delwin ncurses_doupdate ncurses_echo ncurses_echochar ncurses_end ncurses_erase ncurses_erasechar ncurses_filter ncurses_flash ncurses_flushinp ncurses_getch ncurses_getmaxyx ncurses_getmouse ncurses_getyx ncurses_halfdelay ncurses_has_colors ncurses_has_ic ncurses_has_il ncurses_has_key ncurses_hide_panel ncurses_hline ncurses_inch ncurses_init_color ncurses_init_pair ncurses_init ncurses_insch ncurses_insdelln ncurses_insertln ncurses_insstr ncurses_instr ncurses_isendwin ncurses_keyok ncurses_keypad ncurses_killchar ncurses_longname ncurses_meta ncurses_mouse_trafo ncurses_mouseinterval ncurses_mousemask ncurses_move_panel ncurses_move ncurses_mvaddch ncurses_mvaddchnstr ncurses_mvaddchstr ncurses_mvaddnstr ncurses_mvaddstr ncurses_mvcur ncurses_mvdelch ncurses_mvgetch ncurses_mvhline ncurses_mvinch ncurses_mvvline ncurses_mvwaddstr ncurses_napms ncurses_new_panel ncurses_newpad ncurses_newwin ncurses_nl ncurses_nocbreak ncurses_noecho ncurses_nonl ncurses_noqiflush ncurses_noraw ncurses_pair_content ncurses_panel_above ncurses_panel_below ncurses_panel_window ncurses_pnoutrefresh ncurses_prefresh ncurses_putp ncurses_qiflush ncurses_raw ncurses_refresh ncurses_replace_panel ncurses_reset_prog_mode ncurses_reset_shell_mode ncurses_resetty ncurses_savetty ncurses_scr_dump ncurses_scr_init ncurses_scr_restore ncurses_scr_set ncurses_scrl ncurses_show_panel ncurses_slk_attr ncurses_slk_attroff ncurses_slk_attron ncurses_slk_attrset ncurses_slk_clear ncurses_slk_color ncurses_slk_init ncurses_slk_noutrefresh ncurses_slk_refresh ncurses_slk_restore ncurses_slk_set ncurses_slk_touch ncurses_standend ncurses_standout ncurses_start_color ncurses_termattrs ncurses_termname ncurses_timeout ncurses_top_panel ncurses_typeahead ncurses_ungetch ncurses_ungetmouse ncurses_update_panels ncurses_use_default_colors ncurses_use_env ncurses_use_extended_names ncurses_vidattr ncurses_vline ncurses_waddch ncurses_waddstr ncurses_wattroff ncurses_wattron ncurses_wattrset ncurses_wborder ncurses_wclear ncurses_wcolor_set ncurses_werase ncurses_wgetch ncurses_whline ncurses_wmouse_trafo ncurses_wmove ncurses_wnoutrefresh ncurses_wrefresh ncurses_wstandend ncurses_wstandout ncurses_wvline ncurses_addch) b["Gopher"] = Set.new %w(gopher_parsedir gopher_parsedir gopher_parsedir) b["Network"] = Set.new %w(checkdnsrr checkdnsrr closelog define_syslog_variables dns_check_record dns_get_mx dns_get_record fsockopen gethostbyaddr gethostbyname gethostbynamel gethostname getmxrr getprotobyname getprotobynumber getservbyname getservbyport header_register_callback header_remove header headers_list headers_sent http_response_code inet_ntop inet_pton ip2long long2ip openlog pfsockopen setcookie setrawcookie socket_get_status socket_set_blocking socket_set_timeout syslog checkdnsrr) b["Newt"] = Set.new %w(newt_bell newt_bell newt_button_bar newt_button newt_centered_window newt_checkbox_get_value newt_checkbox_set_flags newt_checkbox_set_value newt_checkbox_tree_add_item newt_checkbox_tree_find_item newt_checkbox_tree_get_current newt_checkbox_tree_get_entry_value newt_checkbox_tree_get_multi_selection newt_checkbox_tree_get_selection newt_checkbox_tree_multi newt_checkbox_tree_set_current newt_checkbox_tree_set_entry_value newt_checkbox_tree_set_entry newt_checkbox_tree_set_width newt_checkbox_tree newt_checkbox newt_clear_key_buffer newt_cls newt_compact_button newt_component_add_callback newt_component_takes_focus newt_create_grid newt_cursor_off newt_cursor_on newt_delay newt_draw_form newt_draw_root_text newt_entry_get_value newt_entry_set_filter newt_entry_set_flags newt_entry_set newt_entry newt_finished newt_form_add_component newt_form_add_components newt_form_add_hot_key newt_form_destroy newt_form_get_current newt_form_run newt_form_set_background newt_form_set_height newt_form_set_size newt_form_set_timer newt_form_set_width newt_form_watch_fd newt_form newt_get_screen_size newt_grid_add_components_to_form newt_grid_basic_window newt_grid_free newt_grid_get_size newt_grid_h_close_stacked newt_grid_h_stacked newt_grid_place newt_grid_set_field newt_grid_simple_window newt_grid_v_close_stacked newt_grid_v_stacked newt_grid_wrapped_window_at newt_grid_wrapped_window newt_init newt_label_set_text newt_label newt_listbox_append_entry newt_listbox_clear_selection newt_listbox_clear newt_listbox_delete_entry newt_listbox_get_current newt_listbox_get_selection newt_listbox_insert_entry newt_listbox_item_count newt_listbox_select_item newt_listbox_set_current_by_key newt_listbox_set_current newt_listbox_set_data newt_listbox_set_entry newt_listbox_set_width newt_listbox newt_listitem_get_data newt_listitem_set newt_listitem newt_open_window newt_pop_help_line newt_pop_window newt_push_help_line newt_radio_get_current newt_radiobutton newt_redraw_help_line newt_reflow_text newt_refresh newt_resize_screen newt_resume newt_run_form newt_scale_set newt_scale newt_scrollbar_set newt_set_help_callback newt_set_suspend_callback newt_suspend newt_textbox_get_num_lines newt_textbox_reflowed newt_textbox_set_height newt_textbox_set_text newt_textbox newt_vertical_scrollbar newt_wait_for_key newt_win_choice newt_win_entries newt_win_menu newt_win_message newt_win_messagev newt_win_ternary newt_bell) b["YP/NIS"] = Set.new %w(yp_all yp_all yp_cat yp_err_string yp_errno yp_first yp_get_default_domain yp_master yp_match yp_next yp_order yp_all) b["NSAPI"] = Set.new %w(nsapi_request_headers nsapi_request_headers nsapi_response_headers nsapi_virtual nsapi_request_headers) b["OAuth"] = Set.new %w(oauth_get_sbs oauth_get_sbs oauth_urlencode oauth_get_sbs) b["OCI8"] = Set.new %w(oci_bind_array_by_name oci_bind_array_by_name oci_bind_by_name oci_cancel oci_client_version oci_close oci_commit oci_connect oci_define_by_name oci_error oci_execute oci_fetch_all oci_fetch_array oci_fetch_assoc oci_fetch_object oci_fetch_row oci_fetch oci_field_is_null oci_field_name oci_field_precision oci_field_scale oci_field_size oci_field_type_raw oci_field_type oci_free_descriptor oci_free_statement oci_get_implicit_resultset oci_internal_debug oci_lob_copy oci_lob_is_equal oci_new_collection oci_new_connect oci_new_cursor oci_new_descriptor oci_num_fields oci_num_rows oci_parse oci_password_change oci_pconnect oci_result oci_rollback oci_server_version oci_set_action oci_set_client_identifier oci_set_client_info oci_set_edition oci_set_module_name oci_set_prefetch oci_statement_type oci_bind_array_by_name) b["OPcache"] = Set.new %w(opcache_compile_file opcache_compile_file opcache_get_configuration opcache_get_status opcache_invalidate opcache_is_script_cached opcache_reset opcache_compile_file) b["OpenAL"] = Set.new %w(openal_buffer_create openal_buffer_create openal_buffer_data openal_buffer_destroy openal_buffer_get openal_buffer_loadwav openal_context_create openal_context_current openal_context_destroy openal_context_process openal_context_suspend openal_device_close openal_device_open openal_listener_get openal_listener_set openal_source_create openal_source_destroy openal_source_get openal_source_pause openal_source_play openal_source_rewind openal_source_set openal_source_stop openal_stream openal_buffer_create) b["OpenSSL"] = Set.new %w(openssl_cipher_iv_length openssl_cipher_iv_length openssl_csr_export_to_file openssl_csr_export openssl_csr_get_public_key openssl_csr_get_subject openssl_csr_new openssl_csr_sign openssl_decrypt openssl_dh_compute_key openssl_digest openssl_encrypt openssl_error_string openssl_free_key openssl_get_cert_locations openssl_get_cipher_methods openssl_get_md_methods openssl_get_privatekey openssl_get_publickey openssl_open openssl_pbkdf2 openssl_pkcs12_export_to_file openssl_pkcs12_export openssl_pkcs12_read openssl_pkcs7_decrypt openssl_pkcs7_encrypt openssl_pkcs7_sign openssl_pkcs7_verify openssl_pkey_export_to_file openssl_pkey_export openssl_pkey_free openssl_pkey_get_details openssl_pkey_get_private openssl_pkey_get_public openssl_pkey_new openssl_private_decrypt openssl_private_encrypt openssl_public_decrypt openssl_public_encrypt openssl_random_pseudo_bytes openssl_seal openssl_sign openssl_spki_export_challenge openssl_spki_export openssl_spki_new openssl_spki_verify openssl_verify openssl_x509_check_private_key openssl_x509_checkpurpose openssl_x509_export_to_file openssl_x509_export openssl_x509_fingerprint openssl_x509_free openssl_x509_parse openssl_x509_read openssl_cipher_iv_length) b["Output Control"] = Set.new %w(flush flush ob_clean ob_end_clean ob_end_flush ob_flush ob_get_clean ob_get_contents ob_get_flush ob_get_length ob_get_level ob_get_status ob_gzhandler ob_implicit_flush ob_list_handlers ob_start output_add_rewrite_var output_reset_rewrite_vars flush) b["Paradox"] = Set.new %w(px_close px_close px_create_fp px_date2string px_delete_record px_delete px_get_field px_get_info px_get_parameter px_get_record px_get_schema px_get_value px_insert_record px_new px_numfields px_numrecords px_open_fp px_put_record px_retrieve_record px_set_blob_file px_set_parameter px_set_tablename px_set_targetencoding px_set_value px_timestamp2string px_update_record px_close) b["Parsekit"] = Set.new %w(parsekit_compile_file parsekit_compile_file parsekit_compile_string parsekit_func_arginfo parsekit_compile_file) b["Password Hashing"] = Set.new %w(password_get_info password_get_info password_hash password_needs_rehash password_verify password_get_info) b["PCNTL"] = Set.new %w(pcntl_alarm pcntl_alarm pcntl_errno pcntl_exec pcntl_fork pcntl_get_last_error pcntl_getpriority pcntl_setpriority pcntl_signal_dispatch pcntl_signal_get_handler pcntl_signal pcntl_sigprocmask pcntl_sigtimedwait pcntl_sigwaitinfo pcntl_strerror pcntl_wait pcntl_waitpid pcntl_wexitstatus pcntl_wifexited pcntl_wifsignaled pcntl_wifstopped pcntl_wstopsig pcntl_wtermsig pcntl_alarm) b["PCRE"] = Set.new %w(preg_filter preg_filter preg_grep preg_last_error preg_match_all preg_match preg_quote preg_replace_callback_array preg_replace_callback preg_replace preg_split preg_filter) b["PDF"] = Set.new %w(PDF_activate_item PDF_activate_item PDF_add_annotation PDF_add_bookmark PDF_add_launchlink PDF_add_locallink PDF_add_nameddest PDF_add_note PDF_add_outline PDF_add_pdflink PDF_add_table_cell PDF_add_textflow PDF_add_thumbnail PDF_add_weblink PDF_arc PDF_arcn PDF_attach_file PDF_begin_document PDF_begin_font PDF_begin_glyph PDF_begin_item PDF_begin_layer PDF_begin_page_ext PDF_begin_page PDF_begin_pattern PDF_begin_template_ext PDF_begin_template PDF_circle PDF_clip PDF_close_image PDF_close_pdi_page PDF_close_pdi PDF_close PDF_closepath_fill_stroke PDF_closepath_stroke PDF_closepath PDF_concat PDF_continue_text PDF_create_3dview PDF_create_action PDF_create_annotation PDF_create_bookmark PDF_create_field PDF_create_fieldgroup PDF_create_gstate PDF_create_pvf PDF_create_textflow PDF_curveto PDF_define_layer PDF_delete_pvf PDF_delete_table PDF_delete_textflow PDF_delete PDF_encoding_set_char PDF_end_document PDF_end_font PDF_end_glyph PDF_end_item PDF_end_layer PDF_end_page_ext PDF_end_page PDF_end_pattern PDF_end_template PDF_endpath PDF_fill_imageblock PDF_fill_pdfblock PDF_fill_stroke PDF_fill_textblock PDF_fill PDF_findfont PDF_fit_image PDF_fit_pdi_page PDF_fit_table PDF_fit_textflow PDF_fit_textline PDF_get_apiname PDF_get_buffer PDF_get_errmsg PDF_get_errnum PDF_get_font PDF_get_fontname PDF_get_fontsize PDF_get_image_height PDF_get_image_width PDF_get_majorversion PDF_get_minorversion PDF_get_parameter PDF_get_pdi_parameter PDF_get_pdi_value PDF_get_value PDF_info_font PDF_info_matchbox PDF_info_table PDF_info_textflow PDF_info_textline PDF_initgraphics PDF_lineto PDF_load_3ddata PDF_load_font PDF_load_iccprofile PDF_load_image PDF_makespotcolor PDF_moveto PDF_new PDF_open_ccitt PDF_open_file PDF_open_gif PDF_open_image_file PDF_open_image PDF_open_jpeg PDF_open_memory_image PDF_open_pdi_document PDF_open_pdi_page PDF_open_pdi PDF_open_tiff PDF_pcos_get_number PDF_pcos_get_stream PDF_pcos_get_string PDF_place_image PDF_place_pdi_page PDF_process_pdi PDF_rect PDF_restore PDF_resume_page PDF_rotate PDF_save PDF_scale PDF_set_border_color PDF_set_border_dash PDF_set_border_style PDF_set_char_spacing PDF_set_duration PDF_set_gstate PDF_set_horiz_scaling PDF_set_info_author PDF_set_info_creator PDF_set_info_keywords PDF_set_info_subject PDF_set_info_title PDF_set_info PDF_set_layer_dependency PDF_set_leading PDF_set_parameter PDF_set_text_matrix PDF_set_text_pos PDF_set_text_rendering PDF_set_text_rise PDF_set_value PDF_set_word_spacing PDF_setcolor PDF_setdash PDF_setdashpattern PDF_setflat PDF_setfont PDF_setgray_fill PDF_setgray_stroke PDF_setgray PDF_setlinecap PDF_setlinejoin PDF_setlinewidth PDF_setmatrix PDF_setmiterlimit PDF_setpolydash PDF_setrgbcolor_fill PDF_setrgbcolor_stroke PDF_setrgbcolor PDF_shading_pattern PDF_shading PDF_shfill PDF_show_boxed PDF_show_xy PDF_show PDF_skew PDF_stringwidth PDF_stroke PDF_suspend_page PDF_translate PDF_utf16_to_utf8 PDF_utf32_to_utf16 PDF_utf8_to_utf16 PDF_activate_item) b["PostgreSQL"] = Set.new %w(pg_affected_rows pg_affected_rows pg_cancel_query pg_client_encoding pg_close pg_connect_poll pg_connect pg_connection_busy pg_connection_reset pg_connection_status pg_consume_input pg_convert pg_copy_from pg_copy_to pg_dbname pg_delete pg_end_copy pg_escape_bytea pg_escape_identifier pg_escape_literal pg_escape_string pg_execute pg_fetch_all_columns pg_fetch_all pg_fetch_array pg_fetch_assoc pg_fetch_object pg_fetch_result pg_fetch_row pg_field_is_null pg_field_name pg_field_num pg_field_prtlen pg_field_size pg_field_table pg_field_type_oid pg_field_type pg_flush pg_free_result pg_get_notify pg_get_pid pg_get_result pg_host pg_insert pg_last_error pg_last_notice pg_last_oid pg_lo_close pg_lo_create pg_lo_export pg_lo_import pg_lo_open pg_lo_read_all pg_lo_read pg_lo_seek pg_lo_tell pg_lo_truncate pg_lo_unlink pg_lo_write pg_meta_data pg_num_fields pg_num_rows pg_options pg_parameter_status pg_pconnect pg_ping pg_port pg_prepare pg_put_line pg_query_params pg_query pg_result_error_field pg_result_error pg_result_seek pg_result_status pg_select pg_send_execute pg_send_prepare pg_send_query_params pg_send_query pg_set_client_encoding pg_set_error_verbosity pg_socket pg_trace pg_transaction_status pg_tty pg_unescape_bytea pg_untrace pg_update pg_version pg_affected_rows) b["POSIX"] = Set.new %w(posix_access posix_access posix_ctermid posix_errno posix_get_last_error posix_getcwd posix_getegid posix_geteuid posix_getgid posix_getgrgid posix_getgrnam posix_getgroups posix_getlogin posix_getpgid posix_getpgrp posix_getpid posix_getppid posix_getpwnam posix_getpwuid posix_getrlimit posix_getsid posix_getuid posix_initgroups posix_isatty posix_kill posix_mkfifo posix_mknod posix_setegid posix_seteuid posix_setgid posix_setpgid posix_setrlimit posix_setsid posix_setuid posix_strerror posix_times posix_ttyname posix_uname posix_access) b["Proctitle"] = Set.new %w(setproctitle setproctitle setthreadtitle setproctitle) b["PS"] = Set.new %w(ps_add_bookmark ps_add_bookmark ps_add_launchlink ps_add_locallink ps_add_note ps_add_pdflink ps_add_weblink ps_arc ps_arcn ps_begin_page ps_begin_pattern ps_begin_template ps_circle ps_clip ps_close_image ps_close ps_closepath_stroke ps_closepath ps_continue_text ps_curveto ps_delete ps_end_page ps_end_pattern ps_end_template ps_fill_stroke ps_fill ps_findfont ps_get_buffer ps_get_parameter ps_get_value ps_hyphenate ps_include_file ps_lineto ps_makespotcolor ps_moveto ps_new ps_open_file ps_open_image_file ps_open_image ps_open_memory_image ps_place_image ps_rect ps_restore ps_rotate ps_save ps_scale ps_set_border_color ps_set_border_dash ps_set_border_style ps_set_info ps_set_parameter ps_set_text_pos ps_set_value ps_setcolor ps_setdash ps_setflat ps_setfont ps_setgray ps_setlinecap ps_setlinejoin ps_setlinewidth ps_setmiterlimit ps_setoverprintmode ps_setpolydash ps_shading_pattern ps_shading ps_shfill ps_show_boxed ps_show_xy2 ps_show_xy ps_show2 ps_show ps_string_geometry ps_stringwidth ps_stroke ps_symbol_name ps_symbol_width ps_symbol ps_translate ps_add_bookmark) b["Pspell"] = Set.new %w(pspell_add_to_personal pspell_add_to_personal pspell_add_to_session pspell_check pspell_clear_session pspell_config_create pspell_config_data_dir pspell_config_dict_dir pspell_config_ignore pspell_config_mode pspell_config_personal pspell_config_repl pspell_config_runtogether pspell_config_save_repl pspell_new_config pspell_new_personal pspell_new pspell_save_wordlist pspell_store_replacement pspell_suggest pspell_add_to_personal) b["Radius"] = Set.new %w(radius_acct_open radius_acct_open radius_add_server radius_auth_open radius_close radius_config radius_create_request radius_cvt_addr radius_cvt_int radius_cvt_string radius_demangle_mppe_key radius_demangle radius_get_attr radius_get_tagged_attr_data radius_get_tagged_attr_tag radius_get_vendor_attr radius_put_addr radius_put_attr radius_put_int radius_put_string radius_put_vendor_addr radius_put_vendor_attr radius_put_vendor_int radius_put_vendor_string radius_request_authenticator radius_salt_encrypt_attr radius_send_request radius_server_secret radius_strerror radius_acct_open) b["Rar"] = Set.new %w(rar_wrapper_cache_stats rar_wrapper_cache_stats rar_wrapper_cache_stats) b["Readline"] = Set.new %w(readline_add_history readline_add_history readline_callback_handler_install readline_callback_handler_remove readline_callback_read_char readline_clear_history readline_completion_function readline_info readline_list_history readline_on_new_line readline_read_history readline_redisplay readline_write_history readline readline_add_history) b["Recode"] = Set.new %w(recode_file recode_file recode_string recode recode_file) b["POSIX Regex"] = Set.new %w(ereg_replace ereg_replace ereg eregi_replace eregi split spliti sql_regcase ereg_replace) b["RPM Reader"] = Set.new %w(rpm_close rpm_close rpm_get_tag rpm_is_valid rpm_open rpm_version rpm_close) b["RRD"] = Set.new %w(rrd_create rrd_create rrd_error rrd_fetch rrd_first rrd_graph rrd_info rrd_last rrd_lastupdate rrd_restore rrd_tune rrd_update rrd_version rrd_xport rrdc_disconnect rrd_create) b["runkit"] = Set.new %w(runkit_class_adopt runkit_class_emancipate runkit_constant_add runkit_constant_redefine runkit_constant_remove runkit_function_add runkit_function_copy runkit_function_redefine runkit_function_remove runkit_function_rename runkit_import runkit_lint_file runkit_lint runkit_method_add runkit_method_copy runkit_method_redefine runkit_method_remove runkit_method_rename runkit_return_value_used runkit_sandbox_output_handler runkit_superglobals) b["SAM"] = Set.new %w() b["SCA"] = Set.new %w() b["SDO DAS XML"] = Set.new %w() b["SDO"] = Set.new %w() b["SDO-DAS-Relational"] = Set.new %w() b["Semaphore"] = Set.new %w(ftok ftok msg_get_queue msg_queue_exists msg_receive msg_remove_queue msg_send msg_set_queue msg_stat_queue sem_acquire sem_get sem_release sem_remove shm_attach shm_detach shm_get_var shm_has_var shm_put_var shm_remove_var shm_remove ftok) b["Session PgSQL"] = Set.new %w(session_pgsql_add_error session_pgsql_add_error session_pgsql_get_error session_pgsql_get_field session_pgsql_reset session_pgsql_set_field session_pgsql_status session_pgsql_add_error) b["Session"] = Set.new %w(session_abort session_abort session_cache_expire session_cache_limiter session_commit session_create_id session_decode session_destroy session_encode session_gc session_get_cookie_params session_id session_is_registered session_module_name session_name session_regenerate_id session_register_shutdown session_register session_reset session_save_path session_set_cookie_params session_set_save_handler session_start session_status session_unregister session_unset session_write_close session_abort) b["Shared Memory"] = Set.new %w(shmop_close shmop_close shmop_delete shmop_open shmop_read shmop_size shmop_write shmop_close) b["SimpleXML"] = Set.new %w(simplexml_import_dom simplexml_import_dom simplexml_load_file simplexml_load_string simplexml_import_dom) b["SNMP"] = Set.new %w(snmp_get_quick_print snmp_get_quick_print snmp_get_valueretrieval snmp_read_mib snmp_set_enum_print snmp_set_oid_numeric_print snmp_set_oid_output_format snmp_set_quick_print snmp_set_valueretrieval snmp2_get snmp2_getnext snmp2_real_walk snmp2_set snmp2_walk snmp3_get snmp3_getnext snmp3_real_walk snmp3_set snmp3_walk snmpget snmpgetnext snmprealwalk snmpset snmpwalk snmpwalkoid snmp_get_quick_print) b["SOAP"] = Set.new %w(is_soap_fault is_soap_fault use_soap_error_handler is_soap_fault) b["Socket"] = Set.new %w(socket_accept socket_accept socket_bind socket_clear_error socket_close socket_cmsg_space socket_connect socket_create_listen socket_create_pair socket_create socket_get_option socket_getopt socket_getpeername socket_getsockname socket_import_stream socket_last_error socket_listen socket_read socket_recv socket_recvfrom socket_recvmsg socket_select socket_send socket_sendmsg socket_sendto socket_set_block socket_set_nonblock socket_set_option socket_setopt socket_shutdown socket_strerror socket_write socket_accept) b["Solr"] = Set.new %w(solr_get_version solr_get_version solr_get_version) b["SPL"] = Set.new %w(class_implements class_implements class_parents class_uses iterator_apply iterator_count iterator_to_array spl_autoload_call spl_autoload_extensions spl_autoload_functions spl_autoload_register spl_autoload_unregister spl_autoload spl_classes spl_object_hash class_implements) b["SQLite"] = Set.new %w(sqlite_array_query sqlite_array_query sqlite_busy_timeout sqlite_changes sqlite_close sqlite_column sqlite_create_aggregate sqlite_create_function sqlite_current sqlite_error_string sqlite_escape_string sqlite_exec sqlite_factory sqlite_fetch_all sqlite_fetch_array sqlite_fetch_column_types sqlite_fetch_object sqlite_fetch_single sqlite_fetch_string sqlite_field_name sqlite_has_more sqlite_has_prev sqlite_key sqlite_last_error sqlite_last_insert_rowid sqlite_libencoding sqlite_libversion sqlite_next sqlite_num_fields sqlite_num_rows sqlite_open sqlite_popen sqlite_prev sqlite_query sqlite_rewind sqlite_seek sqlite_single_query sqlite_udf_decode_binary sqlite_udf_encode_binary sqlite_unbuffered_query sqlite_valid sqlite_array_query) b["SQLSRV"] = Set.new %w(sqlsrv_begin_transaction sqlsrv_begin_transaction sqlsrv_cancel sqlsrv_client_info sqlsrv_close sqlsrv_commit sqlsrv_configure sqlsrv_connect sqlsrv_errors sqlsrv_execute sqlsrv_fetch_array sqlsrv_fetch_object sqlsrv_fetch sqlsrv_field_metadata sqlsrv_free_stmt sqlsrv_get_config sqlsrv_get_field sqlsrv_has_rows sqlsrv_next_result sqlsrv_num_fields sqlsrv_num_rows sqlsrv_prepare sqlsrv_query sqlsrv_rollback sqlsrv_rows_affected sqlsrv_send_stream_data sqlsrv_server_info sqlsrv_begin_transaction) b["ssdeep"] = Set.new %w(ssdeep_fuzzy_compare ssdeep_fuzzy_compare ssdeep_fuzzy_hash_filename ssdeep_fuzzy_hash ssdeep_fuzzy_compare) b["SSH2"] = Set.new %w(ssh2_auth_agent ssh2_auth_agent ssh2_auth_hostbased_file ssh2_auth_none ssh2_auth_password ssh2_auth_pubkey_file ssh2_connect ssh2_exec ssh2_fetch_stream ssh2_fingerprint ssh2_methods_negotiated ssh2_publickey_add ssh2_publickey_init ssh2_publickey_list ssh2_publickey_remove ssh2_scp_recv ssh2_scp_send ssh2_sftp_chmod ssh2_sftp_lstat ssh2_sftp_mkdir ssh2_sftp_readlink ssh2_sftp_realpath ssh2_sftp_rename ssh2_sftp_rmdir ssh2_sftp_stat ssh2_sftp_symlink ssh2_sftp_unlink ssh2_sftp ssh2_shell ssh2_tunnel ssh2_auth_agent) b["Statistic"] = Set.new %w(stats_absolute_deviation stats_absolute_deviation stats_cdf_beta stats_cdf_binomial stats_cdf_cauchy stats_cdf_chisquare stats_cdf_exponential stats_cdf_f stats_cdf_gamma stats_cdf_laplace stats_cdf_logistic stats_cdf_negative_binomial stats_cdf_noncentral_chisquare stats_cdf_noncentral_f stats_cdf_poisson stats_cdf_t stats_cdf_uniform stats_cdf_weibull stats_covariance stats_den_uniform stats_dens_beta stats_dens_cauchy stats_dens_chisquare stats_dens_exponential stats_dens_f stats_dens_gamma stats_dens_laplace stats_dens_logistic stats_dens_negative_binomial stats_dens_normal stats_dens_pmf_binomial stats_dens_pmf_hypergeometric stats_dens_pmf_poisson stats_dens_t stats_dens_weibull stats_harmonic_mean stats_kurtosis stats_rand_gen_beta stats_rand_gen_chisquare stats_rand_gen_exponential stats_rand_gen_f stats_rand_gen_funiform stats_rand_gen_gamma stats_rand_gen_ibinomial_negative stats_rand_gen_ibinomial stats_rand_gen_int stats_rand_gen_ipoisson stats_rand_gen_iuniform stats_rand_gen_noncenral_chisquare stats_rand_gen_noncentral_f stats_rand_gen_noncentral_t stats_rand_gen_normal stats_rand_gen_t stats_rand_get_seeds stats_rand_phrase_to_seeds stats_rand_ranf stats_rand_setall stats_skew stats_standard_deviation stats_stat_binomial_coef stats_stat_correlation stats_stat_gennch stats_stat_independent_t stats_stat_innerproduct stats_stat_noncentral_t stats_stat_paired_t stats_stat_percentile stats_stat_powersum stats_variance stats_absolute_deviation) b["Stomp"] = Set.new %w(stomp_connect_error stomp_connect_error stomp_version stomp_connect_error) b["Stream"] = Set.new %w(set_socket_blocking set_socket_blocking stream_bucket_append stream_bucket_make_writeable stream_bucket_new stream_bucket_prepend stream_context_create stream_context_get_default stream_context_get_options stream_context_get_params stream_context_set_default stream_context_set_option stream_context_set_params stream_copy_to_stream stream_encoding stream_filter_append stream_filter_prepend stream_filter_register stream_filter_remove stream_get_contents stream_get_filters stream_get_line stream_get_meta_data stream_get_transports stream_get_wrappers stream_is_local stream_notification_callback stream_register_wrapper stream_resolve_include_path stream_select stream_set_blocking stream_set_chunk_size stream_set_read_buffer stream_set_timeout stream_set_write_buffer stream_socket_accept stream_socket_client stream_socket_enable_crypto stream_socket_get_name stream_socket_pair stream_socket_recvfrom stream_socket_sendto stream_socket_server stream_socket_shutdown stream_supports_lock stream_wrapper_register stream_wrapper_restore stream_wrapper_unregister set_socket_blocking) b["String"] = Set.new %w(addcslashes addcslashes addslashes bin2hex chop chr chunk_split convert_cyr_string convert_uudecode convert_uuencode count_chars crc32 crypt echo explode fprintf get_html_translation_table hebrev hebrevc hex2bin html_entity_decode htmlentities htmlspecialchars_decode htmlspecialchars implode join lcfirst levenshtein localeconv ltrim md5_file md5 metaphone money_format nl_langinfo nl2br number_format ord parse_str print printf quoted_printable_decode quoted_printable_encode quotemeta rtrim setlocale sha1_file sha1 similar_text soundex sprintf sscanf str_getcsv str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split str_word_count strcasecmp strchr strcmp strcoll strcspn strip_tags stripcslashes stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk strpos strrchr strrev strripos strrpos strspn strstr strtok strtolower strtoupper strtr substr_compare substr_count substr_replace substr trim ucfirst ucwords vfprintf vprintf vsprintf wordwrap addcslashes) b["SVN"] = Set.new %w(svn_add svn_add svn_auth_get_parameter svn_auth_set_parameter svn_blame svn_cat svn_checkout svn_cleanup svn_client_version svn_commit svn_delete svn_diff svn_export svn_fs_abort_txn svn_fs_apply_text svn_fs_begin_txn2 svn_fs_change_node_prop svn_fs_check_path svn_fs_contents_changed svn_fs_copy svn_fs_delete svn_fs_dir_entries svn_fs_file_contents svn_fs_file_length svn_fs_is_dir svn_fs_is_file svn_fs_make_dir svn_fs_make_file svn_fs_node_created_rev svn_fs_node_prop svn_fs_props_changed svn_fs_revision_prop svn_fs_revision_root svn_fs_txn_root svn_fs_youngest_rev svn_import svn_log svn_ls svn_mkdir svn_repos_create svn_repos_fs_begin_txn_for_commit svn_repos_fs_commit_txn svn_repos_fs svn_repos_hotcopy svn_repos_open svn_repos_recover svn_revert svn_status svn_update svn_add) b["Swish"] = Set.new %w() b["Sybase"] = Set.new %w(sybase_affected_rows sybase_affected_rows sybase_close sybase_connect sybase_data_seek sybase_deadlock_retry_count sybase_fetch_array sybase_fetch_assoc sybase_fetch_field sybase_fetch_object sybase_fetch_row sybase_field_seek sybase_free_result sybase_get_last_message sybase_min_client_severity sybase_min_error_severity sybase_min_message_severity sybase_min_server_severity sybase_num_fields sybase_num_rows sybase_pconnect sybase_query sybase_result sybase_select_db sybase_set_message_handler sybase_unbuffered_query sybase_affected_rows) b["Taint"] = Set.new %w(is_tainted is_tainted taint untaint is_tainted) b["TCP"] = Set.new %w(tcpwrap_check tcpwrap_check tcpwrap_check) b["Tidy"] = Set.new %w(ob_tidyhandler ob_tidyhandler tidy_access_count tidy_config_count tidy_error_count tidy_get_output tidy_load_config tidy_reset_config tidy_save_config tidy_set_encoding tidy_setopt tidy_warning_count ob_tidyhandler) b["Tokenizer"] = Set.new %w(token_get_all token_get_all token_name token_get_all) b["Trader"] = Set.new %w(trader_acos trader_acos trader_ad trader_add trader_adosc trader_adx trader_adxr trader_apo trader_aroon trader_aroonosc trader_asin trader_atan trader_atr trader_avgprice trader_bbands trader_beta trader_bop trader_cci trader_cdl2crows trader_cdl3blackcrows trader_cdl3inside trader_cdl3linestrike trader_cdl3outside trader_cdl3starsinsouth trader_cdl3whitesoldiers trader_cdlabandonedbaby trader_cdladvanceblock trader_cdlbelthold trader_cdlbreakaway trader_cdlclosingmarubozu trader_cdlconcealbabyswall trader_cdlcounterattack trader_cdldarkcloudcover trader_cdldoji trader_cdldojistar trader_cdldragonflydoji trader_cdlengulfing trader_cdleveningdojistar trader_cdleveningstar trader_cdlgapsidesidewhite trader_cdlgravestonedoji trader_cdlhammer trader_cdlhangingman trader_cdlharami trader_cdlharamicross trader_cdlhighwave trader_cdlhikkake trader_cdlhikkakemod trader_cdlhomingpigeon trader_cdlidentical3crows trader_cdlinneck trader_cdlinvertedhammer trader_cdlkicking trader_cdlkickingbylength trader_cdlladderbottom trader_cdllongleggeddoji trader_cdllongline trader_cdlmarubozu trader_cdlmatchinglow trader_cdlmathold trader_cdlmorningdojistar trader_cdlmorningstar trader_cdlonneck trader_cdlpiercing trader_cdlrickshawman trader_cdlrisefall3methods trader_cdlseparatinglines trader_cdlshootingstar trader_cdlshortline trader_cdlspinningtop trader_cdlstalledpattern trader_cdlsticksandwich trader_cdltakuri trader_cdltasukigap trader_cdlthrusting trader_cdltristar trader_cdlunique3river trader_cdlupsidegap2crows trader_cdlxsidegap3methods trader_ceil trader_cmo trader_correl trader_cos trader_cosh trader_dema trader_div trader_dx trader_ema trader_errno trader_exp trader_floor trader_get_compat trader_get_unstable_period trader_ht_dcperiod trader_ht_dcphase trader_ht_phasor trader_ht_sine trader_ht_trendline trader_ht_trendmode trader_kama trader_linearreg_angle trader_linearreg_intercept trader_linearreg_slope trader_linearreg trader_ln trader_log10 trader_ma trader_macd trader_macdext trader_macdfix trader_mama trader_mavp trader_max trader_maxindex trader_medprice trader_mfi trader_midpoint trader_midprice trader_min trader_minindex trader_minmax trader_minmaxindex trader_minus_di trader_minus_dm trader_mom trader_mult trader_natr trader_obv trader_plus_di trader_plus_dm trader_ppo trader_roc trader_rocp trader_rocr100 trader_rocr trader_rsi trader_sar trader_sarext trader_set_compat trader_set_unstable_period trader_sin trader_sinh trader_sma trader_sqrt trader_stddev trader_stoch trader_stochf trader_stochrsi trader_sub trader_sum trader_t3 trader_tan trader_tanh trader_tema trader_trange trader_trima trader_trix trader_tsf trader_typprice trader_ultosc trader_var trader_wclprice trader_willr trader_wma trader_acos) b["UI"] = Set.new %w(UI\Draw\Text\Font\fontFamilies UI\Draw\Text\Font\fontFamilies UI\quit UI\run UI\Draw\Text\Font\fontFamilies) b["ODBC"] = Set.new %w(odbc_autocommit odbc_autocommit odbc_binmode odbc_close_all odbc_close odbc_columnprivileges odbc_columns odbc_commit odbc_connect odbc_cursor odbc_data_source odbc_do odbc_error odbc_errormsg odbc_exec odbc_execute odbc_fetch_array odbc_fetch_into odbc_fetch_object odbc_fetch_row odbc_field_len odbc_field_name odbc_field_num odbc_field_precision odbc_field_scale odbc_field_type odbc_foreignkeys odbc_free_result odbc_gettypeinfo odbc_longreadlen odbc_next_result odbc_num_fields odbc_num_rows odbc_pconnect odbc_prepare odbc_primarykeys odbc_procedurecolumns odbc_procedures odbc_result_all odbc_result odbc_rollback odbc_setoption odbc_specialcolumns odbc_statistics odbc_tableprivileges odbc_tables odbc_autocommit) b["Uopz"] = Set.new %w(uopz_backup uopz_backup uopz_compose uopz_copy uopz_delete uopz_extend uopz_flags uopz_function uopz_implement uopz_overload uopz_redefine uopz_rename uopz_restore uopz_undefine uopz_backup) b["URL"] = Set.new %w(base64_decode base64_decode base64_encode get_headers get_meta_tags http_build_query parse_url rawurldecode rawurlencode urldecode urlencode base64_decode) b["Variable handling"] = Set.new %w(boolval boolval debug_zval_dump doubleval empty floatval get_defined_vars get_resource_type gettype import_request_variables intval is_array is_bool is_callable is_double is_float is_int is_integer is_iterable is_long is_null is_numeric is_object is_real is_resource is_scalar is_string isset print_r serialize settype strval unserialize unset var_dump var_export boolval) b["vpopmail"] = Set.new %w(vpopmail_add_alias_domain_ex vpopmail_add_alias_domain_ex vpopmail_add_alias_domain vpopmail_add_domain_ex vpopmail_add_domain vpopmail_add_user vpopmail_alias_add vpopmail_alias_del_domain vpopmail_alias_del vpopmail_alias_get_all vpopmail_alias_get vpopmail_auth_user vpopmail_del_domain_ex vpopmail_del_domain vpopmail_del_user vpopmail_error vpopmail_passwd vpopmail_set_user_quota vpopmail_add_alias_domain_ex) b["WDDX"] = Set.new %w(wddx_add_vars wddx_add_vars wddx_deserialize wddx_packet_end wddx_packet_start wddx_serialize_value wddx_serialize_vars wddx_add_vars) b["win32ps"] = Set.new %w(win32_ps_list_procs win32_ps_list_procs win32_ps_stat_mem win32_ps_stat_proc win32_ps_list_procs) b["win32service"] = Set.new %w(win32_continue_service win32_continue_service win32_create_service win32_delete_service win32_get_last_control_message win32_pause_service win32_query_service_status win32_set_service_status win32_start_service_ctrl_dispatcher win32_start_service win32_stop_service win32_continue_service) b["WinCache"] = Set.new %w(wincache_fcache_fileinfo wincache_fcache_fileinfo wincache_fcache_meminfo wincache_lock wincache_ocache_fileinfo wincache_ocache_meminfo wincache_refresh_if_changed wincache_rplist_fileinfo wincache_rplist_meminfo wincache_scache_info wincache_scache_meminfo wincache_ucache_add wincache_ucache_cas wincache_ucache_clear wincache_ucache_dec wincache_ucache_delete wincache_ucache_exists wincache_ucache_get wincache_ucache_inc wincache_ucache_info wincache_ucache_meminfo wincache_ucache_set wincache_unlock wincache_fcache_fileinfo) b["xattr"] = Set.new %w(xattr_get xattr_get xattr_list xattr_remove xattr_set xattr_supported xattr_get) b["xdiff"] = Set.new %w(xdiff_file_bdiff_size xdiff_file_bdiff_size xdiff_file_bdiff xdiff_file_bpatch xdiff_file_diff_binary xdiff_file_diff xdiff_file_merge3 xdiff_file_patch_binary xdiff_file_patch xdiff_file_rabdiff xdiff_string_bdiff_size xdiff_string_bdiff xdiff_string_bpatch xdiff_string_diff_binary xdiff_string_diff xdiff_string_merge3 xdiff_string_patch_binary xdiff_string_patch xdiff_string_rabdiff xdiff_file_bdiff_size) b["Xhprof"] = Set.new %w(xhprof_disable xhprof_disable xhprof_enable xhprof_sample_disable xhprof_sample_enable xhprof_disable) b["XML Parser"] = Set.new %w(utf8_decode utf8_decode utf8_encode xml_error_string xml_get_current_byte_index xml_get_current_column_number xml_get_current_line_number xml_get_error_code xml_parse_into_struct xml_parse xml_parser_create_ns xml_parser_create xml_parser_free xml_parser_get_option xml_parser_set_option xml_set_character_data_handler xml_set_default_handler xml_set_element_handler xml_set_end_namespace_decl_handler xml_set_external_entity_ref_handler xml_set_notation_decl_handler xml_set_object xml_set_processing_instruction_handler xml_set_start_namespace_decl_handler xml_set_unparsed_entity_decl_handler utf8_decode) b["XML-RPC"] = Set.new %w(xmlrpc_decode_request xmlrpc_decode_request xmlrpc_decode xmlrpc_encode_request xmlrpc_encode xmlrpc_get_type xmlrpc_is_fault xmlrpc_parse_method_descriptions xmlrpc_server_add_introspection_data xmlrpc_server_call_method xmlrpc_server_create xmlrpc_server_destroy xmlrpc_server_register_introspection_callback xmlrpc_server_register_method xmlrpc_set_type xmlrpc_decode_request) b["XMLWriter"] = Set.new %w(XMLWriter::endAttribute XMLWriter::endAttribute XMLWriter::endCData XMLWriter::endComment XMLWriter::endDocument XMLWriter::endDTDAttlist XMLWriter::endDTDElement XMLWriter::endDTDEntity XMLWriter::endDTD XMLWriter::endElement XMLWriter::endPI XMLWriter::flush XMLWriter::fullEndElement XMLWriter::openMemory XMLWriter::openURI XMLWriter::outputMemory XMLWriter::setIndentString XMLWriter::setIndent XMLWriter::startAttributeNS XMLWriter::startAttribute XMLWriter::startCData XMLWriter::startComment XMLWriter::startDocument XMLWriter::startDTDAttlist XMLWriter::startDTDElement XMLWriter::startDTDEntity XMLWriter::startDTD XMLWriter::startElementNS XMLWriter::startElement XMLWriter::startPI XMLWriter::text XMLWriter::writeAttributeNS XMLWriter::writeAttribute XMLWriter::writeCData XMLWriter::writeComment XMLWriter::writeDTDAttlist XMLWriter::writeDTDElement XMLWriter::writeDTDEntity XMLWriter::writeDTD XMLWriter::writeElementNS XMLWriter::writeElement XMLWriter::writePI XMLWriter::writeRaw XMLWriter::endAttribute) b["Yaml"] = Set.new %w(yaml_emit_file yaml_emit_file yaml_emit yaml_parse_file yaml_parse_url yaml_parse yaml_emit_file) b["YAZ"] = Set.new %w(yaz_addinfo yaz_addinfo yaz_ccl_conf yaz_ccl_parse yaz_close yaz_connect yaz_database yaz_element yaz_errno yaz_error yaz_es_result yaz_es yaz_get_option yaz_hits yaz_itemorder yaz_present yaz_range yaz_record yaz_scan_result yaz_scan yaz_schema yaz_search yaz_set_option yaz_sort yaz_syntax yaz_wait yaz_addinfo) b["Zip"] = Set.new %w(zip_close zip_close zip_entry_close zip_entry_compressedsize zip_entry_compressionmethod zip_entry_filesize zip_entry_name zip_entry_open zip_entry_read zip_open zip_read zip_close) b["Zlib"] = Set.new %w(deflate_add deflate_add deflate_init gzclose gzcompress gzdecode gzdeflate gzencode gzeof gzfile gzgetc gzgets gzgetss gzinflate gzopen gzpassthru gzputs gzread gzrewind gzseek gztell gzuncompress gzwrite inflate_add inflate_init readgzfile zlib_decode zlib_encode zlib_get_coding_type deflate_add) end end end end end rouge-2.2.1/lib/rouge/lexers/literate_haskell.rb0000644000175000017500000000141713150713277021534 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class LiterateHaskell < RegexLexer title "Literate Haskell" desc 'Literate haskell' tag 'literate_haskell' aliases 'lithaskell', 'lhaskell', 'lhs' filenames '*.lhs' mimetypes 'text/x-literate-haskell' def haskell @haskell ||= Haskell.new(options) end start { haskell.reset! } # TODO: support TeX versions as well. state :root do rule /\s*?\n(?=>)/, Text, :code rule /.*?\n/, Text rule /.+\z/, Text end state :code do rule /(>)( .*?(\n|\z))/ do |m| token Name::Label, m[1] delegate haskell, m[2] end rule /\s*\n(?=\s*[^>])/, Text, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/yaml.rb0000644000175000017500000002306013150713277017160 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class YAML < RegexLexer title "YAML" desc "Yaml Ain't Markup Language (yaml.org)" mimetypes 'text/x-yaml' tag 'yaml' aliases 'yml' filenames '*.yaml', '*.yml' def self.analyze_text(text) # look for the %YAML directive return 1 if text =~ /\A\s*%YAML/m end SPECIAL_VALUES = Regexp.union(%w(true false null)) # NB: Tabs are forbidden in YAML, which is why you see things # like /[ ]+/. # reset the indentation levels def reset_indent puts " yaml: reset_indent" if @debug @indent_stack = [0] @next_indent = 0 @block_scalar_indent = nil end def indent raise 'empty indent stack!' if @indent_stack.empty? @indent_stack.last end def dedent?(level) level < self.indent end def indent?(level) level > self.indent end # Save a possible indentation level def save_indent(match) @next_indent = match.size puts " yaml: indent: #{self.indent}/#@next_indent" if @debug puts " yaml: popping indent stack - before: #@indent_stack" if @debug if dedent?(@next_indent) @indent_stack.pop while dedent?(@next_indent) puts " yaml: popping indent stack - after: #@indent_stack" if @debug puts " yaml: indent: #{self.indent}/#@next_indent" if @debug # dedenting to a state not previously indented to is an error [match[0...self.indent], match[self.indent..-1]] else [match, ''] end end def continue_indent(match) puts " yaml: continue_indent" if @debug @next_indent += match.size end def set_indent(match, opts={}) if indent < @next_indent puts " yaml: indenting #{indent}/#{@next_indent}" if @debug @indent_stack << @next_indent end @next_indent += match.size unless opts[:implicit] end plain_scalar_start = /[^ \t\n\r\f\v?:,\[\]{}#&*!\|>'"%@`]/ start { reset_indent } state :basic do rule /#.*$/, Comment::Single end state :root do mixin :basic rule /\n+/, Text # trailing or pre-comment whitespace rule /[ ]+(?=#|$)/, Text rule /^%YAML\b/ do token Name::Tag reset_indent push :yaml_directive end rule /^%TAG\b/ do token Name::Tag reset_indent push :tag_directive end # doc-start and doc-end indicators rule /^(?:---|\.\.\.)(?= |$)/ do token Name::Namespace reset_indent push :block_line end # indentation spaces rule /[ ]*(?!\s|$)/ do |m| text, err = save_indent(m[0]) token Text, text token Error, err push :block_line; push :indentation end end state :indentation do rule(/\s*?\n/) { token Text; pop! 2 } # whitespace preceding block collection indicators rule /[ ]+(?=[-:?](?:[ ]|$))/ do |m| token Text continue_indent(m[0]) end # block collection indicators rule(/[?:-](?=[ ]|$)/) do |m| set_indent m[0] token Punctuation::Indicator end # the beginning of a block line rule(/[ ]*/) { |m| token Text; continue_indent(m[0]); pop! } end # indented line in the block context state :block_line do # line end rule /[ ]*(?=#|$)/, Text, :pop! rule /[ ]+/, Text # tags, anchors, and aliases mixin :descriptors # block collections and scalars mixin :block_nodes # flow collections and quoed scalars mixin :flow_nodes # a plain scalar rule /(?=#{plain_scalar_start}|[?:-][^ \t\n\r\f\v])/ do token Name::Variable push :plain_scalar_in_block_context end end state :descriptors do # a full-form tag rule /!<[0-9A-Za-z;\/?:@&=+$,_.!~*'()\[\]%-]+>/, Keyword::Type # a tag in the form '!', '!suffix' or '!handle!suffix' rule %r( (?:![\w-]+)? # handle !(?:[\w;/?:@&=+$,.!~*\'()\[\]%-]*) # suffix )x, Keyword::Type # an anchor rule /&[\w-]+/, Name::Label # an alias rule /\*[\w-]+/, Name::Variable end state :block_nodes do # implicit key rule /((?:\w[\w -]*)?)(:)(?=\s|$)/ do |m| groups Name::Attribute, Punctuation::Indicator set_indent m[0], :implicit => true end # literal and folded scalars rule /[\|>]/ do token Punctuation::Indicator push :block_scalar_content push :block_scalar_header end end state :flow_nodes do rule /\[/, Punctuation::Indicator, :flow_sequence rule /\{/, Punctuation::Indicator, :flow_mapping rule /'/, Str::Single, :single_quoted_scalar rule /"/, Str::Double, :double_quoted_scalar end state :flow_collection do rule /\s+/m, Text mixin :basic rule /[?:,]/, Punctuation::Indicator mixin :descriptors mixin :flow_nodes rule /(?=#{plain_scalar_start})/ do push :plain_scalar_in_flow_context end end state :flow_sequence do rule /\]/, Punctuation::Indicator, :pop! mixin :flow_collection end state :flow_mapping do rule /\}/, Punctuation::Indicator, :pop! mixin :flow_collection end state :block_scalar_content do rule /\n+/, Text # empty lines never dedent, but they might be part of the scalar. rule /^[ ]+$/ do |m| text = m[0] indent_size = text.size indent_mark = @block_scalar_indent || indent_size token Text, text[0...indent_mark] token Name::Constant, text[indent_mark..-1] end # TODO: ^ doesn't actually seem to affect the match at all. # Find a way to work around this limitation. rule /^[ ]*/ do |m| token Text indent_size = m[0].size dedent_level = @block_scalar_indent || self.indent @block_scalar_indent ||= indent_size if indent_size < dedent_level save_indent m[0] pop! push :indentation end end rule /[^\n\r\f\v]+/, Name::Constant end state :block_scalar_header do # optional indentation indicator and chomping flag, in either order rule %r( ( ([1-9])[+-]? | [+-]?([1-9])? )(?=[ ]|$) )x do |m| @block_scalar_indent = nil goto :ignored_line next if m[0].empty? increment = m[1] || m[2] if increment @block_scalar_indent = indent + increment.to_i end token Punctuation::Indicator end end state :ignored_line do mixin :basic rule /[ ]+/, Text rule /\n/, Text, :pop! end state :quoted_scalar_whitespaces do # leading and trailing whitespace is ignored rule /^[ ]+/, Text rule /[ ]+$/, Text rule /\n+/m, Text rule /[ ]+/, Name::Variable end state :single_quoted_scalar do mixin :quoted_scalar_whitespaces rule /\\'/, Str::Escape rule /'/, Str, :pop! rule /[^\s']+/, Str end state :double_quoted_scalar do rule /"/, Str, :pop! mixin :quoted_scalar_whitespaces # escapes rule /\\[0abt\tn\nvfre "\\N_LP]/, Str::Escape rule /\\(?:x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/, Str::Escape rule /[^ \t\n\r\f\v"\\]+/, Str end state :plain_scalar_in_block_context_new_line do rule /^[ ]+\n/, Text rule /\n+/m, Text rule /^(?=---|\.\.\.)/ do pop! 3 end # dedent detection rule /^[ ]*/ do |m| token Text pop! indent_size = m[0].size # dedent = end of scalar if indent_size <= self.indent pop! save_indent(m[0]) push :indentation end end end state :plain_scalar_in_block_context do # the : indicator ends a scalar rule /[ ]*(?=:[ \n]|:$)/, Text, :pop! rule /[ ]*:/, Str rule /[ ]+(?=#)/, Text, :pop! rule /[ ]+$/, Text # check for new documents or dedents at the new line rule /\n+/ do token Text push :plain_scalar_in_block_context_new_line end rule /[ ]+/, Str rule SPECIAL_VALUES, Name::Constant # regular non-whitespace characters rule /[^\s:]+/, Str end state :plain_scalar_in_flow_context do rule /[ ]*(?=[,:?\[\]{}])/, Text, :pop! rule /[ ]+(?=#)/, Text, :pop! rule /^[ ]+/, Text rule /[ ]+$/, Text rule /\n+/, Text rule /[ ]+/, Name::Variable rule /[^\s,:?\[\]{}]+/, Name::Variable end state :yaml_directive do rule /([ ]+)(\d+\.\d+)/ do groups Text, Num goto :ignored_line end end state :tag_directive do rule %r( ([ ]+)(!|![\w-]*!) # prefix ([ ]+)(!|!?[\w;/?:@&=+$,.!~*'()\[\]%-]+) # tag handle )x do groups Text, Keyword::Type, Text, Keyword::Type goto :ignored_line end end end end end rouge-2.2.1/lib/rouge/lexers/ruby.rb0000644000175000017500000003036113150713277017201 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Ruby < RegexLexer title "Ruby" desc "The Ruby programming language (ruby-lang.org)" tag 'ruby' aliases 'rb' filenames '*.rb', '*.ruby', '*.rbw', '*.rake', '*.gemspec', '*.podspec', 'Rakefile', 'Guardfile', 'Gemfile', 'Capfile', 'Podfile', 'Vagrantfile', '*.ru', '*.prawn', 'Berksfile' mimetypes 'text/x-ruby', 'application/x-ruby' def self.analyze_text(text) return 1 if text.shebang? 'ruby' end state :symbols do # symbols rule %r( : # initial : @{0,2} # optional ivar, for :@foo and :@@foo [a-z_]\w*[!?]? # the symbol )xi, Str::Symbol # special symbols rule %r(:(?:\*\*|[-+]@|[/\%&\|^`~]|\[\]=?|<<|>>|<=?>|<=?|===?)), Str::Symbol rule /:'(\\\\|\\'|[^'])*'/, Str::Symbol rule /:"/, Str::Symbol, :simple_sym end state :sigil_strings do # %-sigiled strings # %(abc), %[abc], %, %.abc., %r.abc., etc delimiter_map = { '{' => '}', '[' => ']', '(' => ')', '<' => '>' } rule /%([rqswQWxiI])?([^\w\s])/ do |m| open = Regexp.escape(m[2]) close = Regexp.escape(delimiter_map[m[2]] || m[2]) interp = /[rQWxI]/ === m[1] toktype = Str::Other puts " open: #{open.inspect}" if @debug puts " close: #{close.inspect}" if @debug # regexes if m[1] == 'r' toktype = Str::Regex push :regex_flags end token toktype push do rule /\\[##{open}#{close}\\]/, Str::Escape # nesting rules only with asymmetric delimiters if open != close rule /#{open}/ do token toktype push end end rule /#{close}/, toktype, :pop! if interp mixin :string_intp_escaped rule /#/, toktype else rule /[\\#]/, toktype end rule /[^##{open}#{close}\\]+/m, toktype end end end state :strings do mixin :symbols rule /\b[a-z_]\w*?[?!]?:\s+/, Str::Symbol, :expr_start rule /'(\\\\|\\'|[^'])*'/, Str::Single rule /"/, Str::Double, :simple_string rule /(?_*\$?:"]), Name::Variable::Global rule /\$-[0adFiIlpvw]/, Name::Variable::Global rule /::/, Operator mixin :strings rule /(?:#{keywords.join('|')})\b/, Keyword, :expr_start rule /(?:#{keywords_pseudo.join('|')})\b/, Keyword::Pseudo, :expr_start rule %r( (module) (\s+) ([a-zA-Z_][a-zA-Z0-9_]*(::[a-zA-Z_][a-zA-Z0-9_]*)*) )x do groups Keyword, Text, Name::Namespace end rule /(def\b)(\s*)/ do groups Keyword, Text push :funcname end rule /(class\b)(\s*)/ do groups Keyword, Text push :classname end rule /(?:#{builtins_q.join('|')})[?]/, Name::Builtin, :expr_start rule /(?:#{builtins_b.join('|')})!/, Name::Builtin, :expr_start rule /(?=])/ do groups Punctuation, Text, Name::Function push :method_call end rule /[a-zA-Z_]\w*[?!]/, Name, :expr_start rule /[a-zA-Z_]\w*/, Name, :method_call rule /\*\*|<>?|>=|<=|<=>|=~|={3}|!~|&&?|\|\||\./, Operator, :expr_start rule /[-+\/*%=<>&!^|~]=?/, Operator, :expr_start rule(/[?]/) { token Punctuation; push :ternary; push :expr_start } rule %r<[\[({,:\\;/]>, Punctuation, :expr_start rule %r<[\])}]>, Punctuation end state :has_heredocs do rule /(?>? | <=>? | >= | ===? ) )x do |m| puts "matches: #{[m[0], m[1], m[2], m[3]].inspect}" if @debug groups Name::Class, Operator, Name::Function pop! end rule(//) { pop! } end state :classname do rule /\s+/, Text rule /\(/ do token Punctuation push :defexpr push :expr_start end # class << expr rule /<=0?n[x]:"" rule %r( [?](\\[MC]-)* # modifiers (\\([\\abefnrstv\#"']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})|\S) (?!\w) )x, Str::Char, :pop! # special case for using a single space. Ruby demands that # these be in a single line, otherwise it would make no sense. rule /(\s*)(%[rqswQWxiI]? \S* )/ do groups Text, Str::Other pop! end mixin :sigil_strings rule(//) { pop! } end state :slash_regex do mixin :string_intp rule %r(\\\\), Str::Regex rule %r(\\/), Str::Regex rule %r([\\#]), Str::Regex rule %r([^\\/#]+)m, Str::Regex rule %r(/) do token Str::Regex goto :regex_flags end end state :end_part do # eat up the rest of the stream as Comment::Preproc rule /.+/m, Comment::Preproc, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/biml.rb0000644000175000017500000000173413150713277017145 0ustar uwabamiuwabamimodule Rouge module Lexers load_lexer 'xml.rb' class BIML < XML title "BIML" desc "BIML, Business Intelligence Markup Language" tag 'biml' filenames '*.biml' def self.analyze_text(text) return 1 if text =~ /<\s*Biml\b/ end prepend :root do rule %r(<#\@\s*)m, Name::Tag, :directive_tag rule %r(<#[=]?\s*)m, Name::Tag, :directive_as_csharp end prepend :attr do #TODO: how to deal with embedded <# tags inside a attribute string #rule %r("<#[=]?\s*)m, Name::Tag, :directive_as_csharp end state :directive_as_csharp do rule /\s*#>\s*/m, Name::Tag, :pop! rule %r(.*?(?=\s*#>\s*))m do delegate CSharp end end state :directive_tag do rule /\s+/m, Text rule /[\w.:-]+\s*=/m, Name::Attribute, :attr rule /[\w]+\s*/m, Name::Attribute rule %r(/?\s*#>), Name::Tag, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/xml.rb0000644000175000017500000000265413150713277017024 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class XML < RegexLexer title "XML" desc %q(XML) tag 'xml' filenames *%w(*.xml *.xsl *.rss *.xslt *.xsd *.wsdl *.svg) mimetypes *%w( text/xml application/xml image/svg+xml application/rss+xml application/atom+xml ) def self.analyze_text(text) return 0.9 if text.doctype? return 0.8 if text =~ /\A<\?xml\b/ start = text[0..1000] return 0.6 if start =~ %r(.*?)m end state :root do rule /[^<&]+/, Text rule /&\S*?;/, Name::Entity rule //, Comment::Preproc rule //, Comment, :pop! rule /-/, Comment end state :tag do rule /\s+/m, Text rule /[\w.:-]+\s*=/m, Name::Attribute, :attr rule %r(/?\s*>), Name::Tag, :pop! end state :attr do rule /\s+/m, Text rule /".*?"|'.*?'|[^\s>]+/m, Str, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/coffeescript.rb0000644000175000017500000001053113150713277020671 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Coffeescript < RegexLexer tag 'coffeescript' aliases 'coffee', 'coffee-script' filenames '*.coffee', 'Cakefile' mimetypes 'text/coffeescript' title "CoffeeScript" desc 'The Coffeescript programming language (coffeescript.org)' def self.analyze_text(text) return 1 if text.shebang? 'coffee' end def self.keywords @keywords ||= Set.new %w( for in of while break return continue switch when then if else throw try catch finally new delete typeof instanceof super extends this class by ) end def self.constants @constants ||= Set.new %w( true false yes no on off null NaN Infinity undefined ) end def self.builtins @builtins ||= Set.new %w( Array Boolean Date Error Function Math netscape Number Object Packages RegExp String sun decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt document window ) end id = /[$a-zA-Z_][a-zA-Z0-9_]*/ state :comments_and_whitespace do rule /\s+/m, Text rule /###\s*\n.*?###/m, Comment::Multiline rule /#.*$/, Comment::Single end state :multiline_regex do # this order is important, so that #{ isn't interpreted # as a comment mixin :has_interpolation mixin :comments_and_whitespace rule %r(///([gim]+\b|\B)), Str::Regex, :pop! rule %r(/), Str::Regex rule %r([^/#]+), Str::Regex end state :slash_starts_regex do mixin :comments_and_whitespace rule %r(///) do token Str::Regex goto :multiline_regex end rule %r( /(\\.|[^\[/\\\n]|\[(\\.|[^\]\\\n])*\])+/ # a regex ([gim]+\b|\B) )x, Str::Regex, :pop! rule(//) { pop! } end state :root do rule(%r(^(?=\s|/||<(script|style).*?\2>|<(?!\?(lasso(script)?|=)))+/im) { delegate parent } end state :nosquarebrackets do rule /\[noprocess\]/, Comment::Preproc, :noprocess rule /<\?(lasso(script)?|=)/i, Comment::Preproc, :anglebrackets rule(/([^\[<]||<(script|style).*?\2>|<(?!\?(lasso(script)?|=))|\[(?!noprocess))+/im) { delegate parent } end state :noprocess do rule %r(\[/noprocess\]), Comment::Preproc, :pop! rule(%r(([^\[]|\[(?!/noprocess))+)i) { delegate parent } end state :squarebrackets do rule /\]/, Comment::Preproc, :pop! mixin :lasso end state :anglebrackets do rule /\?>/, Comment::Preproc, :pop! mixin :lasso end state :lassofile do rule /\]|\?>/, Comment::Preproc, :pop! mixin :lasso end state :whitespacecomments do rule /\s+/, Text rule %r(//.*?\n), Comment::Single rule %r(/\*\*!.*?\*/)m, Comment::Doc rule %r(/\*.*?\*/)m, Comment::Multiline end state :lasso do mixin :whitespacecomments # literals rule /\d*\.\d+(e[+-]?\d+)?/i, Num::Float rule /0x[\da-f]+/i, Num::Hex rule /\d+/, Num::Integer rule /(infinity|NaN)\b/i, Num rule /'[^'\\]*(\\.[^'\\]*)*'/m, Str::Single rule /"[^"\\]*(\\.[^"\\]*)*"/m, Str::Double rule /`[^`]*`/m, Str::Backtick # names rule /\$#{id}/, Name::Variable rule /#(#{id}|\d+\b)/, Name::Variable::Instance rule /(\.\s*)('#{id}')/ do groups Name::Builtin::Pseudo, Name::Variable::Class end rule /(self)(\s*->\s*)('#{id}')/i do groups Name::Builtin::Pseudo, Operator, Name::Variable::Class end rule /(\.\.?\s*)(#{id}(=(?!=))?)/ do groups Name::Builtin::Pseudo, Name::Other end rule /(->\\?\s*|&\s*)(#{id}(=(?!=))?)/ do groups Operator, Name::Other end rule /(?)(self|inherited|currentcapture|givenblock)\b/i, Name::Builtin::Pseudo rule /-(?!infinity)#{id}/i, Name::Attribute rule /::\s*#{id}/, Name::Label rule /error_((code|msg)_\w+|adderror|columnrestriction|databaseconnectionunavailable|databasetimeout|deleteerror|fieldrestriction|filenotfound|invaliddatabase|invalidpassword|invalidusername|modulenotfound|noerror|nopermission|outofmemory|reqcolumnmissing|reqfieldmissing|requiredcolumnmissing|requiredfieldmissing|updateerror)/i, Name::Exception # definitions rule /(define)(\s+)(#{id})(\s*=>\s*)(type|trait|thread)\b/i do groups Keyword::Declaration, Text, Name::Class, Operator, Keyword end rule %r((define)(\s+)(#{id})(\s*->\s*)(#{id}=?|[-+*/%]))i do groups Keyword::Declaration, Text, Name::Class, Operator, Name::Function push :signature end rule /(define)(\s+)(#{id})/i do groups Keyword::Declaration, Text, Name::Function push :signature end rule %r((public|protected|private|provide)(\s+)((#{id}=?|[-+*/%])(?=\s*\()))i do groups Keyword, Text, Name::Function push :signature end rule /(public|protected|private|provide)(\s+)(#{id})/i do groups Keyword, Text, Name::Function end # keywords rule /(true|false|none|minimal|full|all|void)\b/i, Keyword::Constant rule /(local|var|variable|global|data(?=\s))\b/i, Keyword::Declaration rule /(array|date|decimal|duration|integer|map|pair|string|tag|xml|null|boolean|bytes|keyword|list|locale|queue|set|stack|staticarray)\b/i, Keyword::Type rule /(#{id})(\s+)(in)\b/i do groups Name, Text, Keyword end rule /(let|into)(\s+)(#{id})/i do groups Keyword, Text, Name end # other rule /,/, Punctuation, :commamember rule /(and|or|not)\b/i, Operator::Word rule /(#{id})(\s*::\s*#{id})?(\s*=(?!=|>))/ do groups Name, Name::Label, Operator end rule %r((/?)([\w.]+)) do |m| name = m[2].downcase if m[1] != '' token Punctuation, m[1] end if name == 'namespace_using' token Keyword::Namespace, m[2] elsif self.class.keywords[:keywords].include? name token Keyword, m[2] elsif self.class.keywords[:types_traits].include? name token Name::Builtin, m[2] else token Name::Other, m[2] end end rule /(=)(n?bw|n?ew|n?cn|lte?|gte?|n?eq|n?rx|ft)\b/i do groups Operator, Operator::Word end rule %r(:=|[-+*/%=<>&|!?\\]+), Operator rule /[{}():;,@^]/, Punctuation end state :signature do rule /\=>/, Operator, :pop! rule /\)/, Punctuation, :pop! rule /[(,]/, Punctuation, :parameter mixin :lasso end state :parameter do rule /\)/, Punctuation, :pop! rule /-?#{id}/, Name::Attribute, :pop! rule /\.\.\./, Name::Builtin::Pseudo mixin :lasso end state :commamember do rule %r((#{id}=?|[-+*/%])(?=\s*(\(([^()]*\([^()]*\))*[^\)]*\)\s*)?(::[\w.\s]+)?=>)), Name::Function, :signature mixin :whitespacecomments rule //, Text, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/typescript/0000755000175000017500000000000013150713277020076 5ustar uwabamiuwabamirouge-2.2.1/lib/rouge/lexers/typescript/common.rb0000644000175000017500000000126413150713277021716 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers module TypescriptCommon def self.keywords @keywords ||= super + Set.new(%w( is namespace static private protected public implements readonly )) end def self.declarations @declarations ||= super + Set.new(%w( type abstract )) end def self.reserved @reserved ||= super + Set.new(%w( string any void number namespace module declare default interface keyof )) end def self.builtins @builtins ||= super + %w( Pick Partial Readonly Record ) end end end end rouge-2.2.1/lib/rouge/lexers/plain_text.rb0000644000175000017500000000074513150713277020372 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class PlainText < Lexer title "Plain Text" desc "A boring lexer that doesn't highlight anything" tag 'plaintext' aliases 'text' filenames '*.txt' mimetypes 'text/plain' attr_reader :token def initialize(*) super @token = token_option(:token) || Text end def stream_tokens(string, &b) yield self.token, string end end end end rouge-2.2.1/lib/rouge/lexers/turtle.rb0000644000175000017500000000376613150713277017550 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Turtle < RegexLexer title "Turtle/TriG" desc "Terse RDF Triple Language, TriG" tag 'turtle' filenames *%w(*.ttl *.trig) mimetypes *%w( text/turtle application/trig ) def self.analyze_text(text) start = text[0..1000] return 0.5 if start =~ %r(@prefix\b) return 0.5 if start =~ %r(@base\b) return 0.4 if start =~ %r(PREFIX\b)i return 0.4 if start =~ %r(BASE\b)i end state :root do rule /@base\b/, Keyword::Declaration rule /@prefix\b/, Keyword::Declaration rule /true\b/, Keyword::Constant rule /false\b/, Keyword::Constant rule /""".*?"""/m, Literal::String rule /"([^"\\]|\\.)*"/, Literal::String rule /'''.*?'''/m, Literal::String rule /'([^'\\]|\\.)*'/, Literal::String rule /#.*$/, Comment::Single rule /@[^\s,.; ]+/, Name::Attribute rule /[+-]?[0-9]+\.[0-9]*E[+-]?[0-9]+/, Literal::Number::Float rule /[+-]?\.[0-9]+E[+-]?[0-9]+/, Literal::Number::Float rule /[+-]?[0-9]+E[+-]?[0-9]+/, Literal::Number::Float rule /[+-]?[0-9]*\.[0-9]+?/, Literal::Number::Float rule /[+-]?[0-9]+/, Literal::Number::Integer rule /\./, Punctuation rule /,/, Punctuation rule /;/, Punctuation rule /\(/, Punctuation rule /\)/, Punctuation rule /\{/, Punctuation rule /\}/, Punctuation rule /\[/, Punctuation rule /\]/, Punctuation rule /\^\^/, Punctuation rule /<[^>]*>/, Name::Label rule /base\b/i, Keyword::Declaration rule /prefix\b/i, Keyword::Declaration rule /GRAPH\b/, Keyword rule /a\b/, Keyword rule /\s+/, Text::Whitespace rule /[^:;<>#\@"\(\).\[\]\{\} ]+:/, Name::Namespace rule /[^:;<>#\@"\(\).\[\]\{\} ]+/, Name end end end end rouge-2.2.1/lib/rouge/lexers/kotlin.rb0000644000175000017500000000473613150713277017527 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Kotlin < RegexLexer title "Kotlin" desc "Kotlin " tag 'kotlin' filenames '*.kt' mimetypes 'text/x-kotlin' keywords = %w( abstract annotation as break by catch class companion const constructor continue crossinline do dynamic else enum external false final finally for fun get if import in infix inline inner interface internal is lateinit noinline null object open operator out override package private protected public reified return sealed set super tailrec this throw true try typealias typeof val var vararg when where while yield ) name = %r'@?[_\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Nl}][\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Nl}\p{Nd}\p{Pc}\p{Cf}\p{Mn}\p{Mc}]*' id = %r'(#{name}|`#{name}`)' state :root do rule %r'^\s*\[.*?\]', Name::Attribute rule %r'[^\S\n]+', Text rule %r'\\\n', Text # line continuation rule %r'//.*?\n', Comment::Single rule %r'/[*].*?[*]/'m, Comment::Multiline rule %r'\n', Text rule %r'::|!!|\?[:.]', Operator rule %r"(\.\.)", Operator rule %r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation rule %r'[{}]', Punctuation rule %r'@"(""|[^"])*"'m, Str rule %r'""".*?"""'m, Str rule %r'"(\\\\|\\"|[^"\n])*["\n]'m, Str rule %r"'\\.'|'[^\\]'", Str::Char rule %r"[0-9](\.[0-9]+)?([eE][+-][0-9]+)?[flFL]?|0[xX][0-9a-fA-F]+[Ll]?", Num rule %r'(companion)(\s+)(object)' do groups Keyword, Text, Keyword end rule %r'(class|data\s+class|interface|object)(\s+)' do groups Keyword::Declaration, Text push :class end rule %r'(package|import)(\s+)' do groups Keyword, Text push :package end rule %r'(val|var)(\s+)' do groups Keyword::Declaration, Text push :property end rule %r'(fun)(\s+)' do groups Keyword, Text push :function end rule /(?:#{keywords.join('|')})\b/, Keyword rule id, Name end state :package do rule /\S+/, Name::Namespace, :pop! end state :class do rule id, Name::Class, :pop! end state :property do rule id, Name::Property, :pop! end state :function do rule id, Name::Function, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/python.rb0000644000175000017500000001472013150713277017542 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Python < RegexLexer title "Python" desc "The Python programming language (python.org)" tag 'python' aliases 'py' filenames '*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript', '*.tac' mimetypes 'text/x-python', 'application/x-python' def self.analyze_text(text) return 1 if text.shebang?(/pythonw?(3|2(\.\d)?)?/) end def self.keywords @keywords ||= %w( assert break continue del elif else except exec finally for global if lambda pass print raise return try while yield as with from import yield ) end def self.builtins @builtins ||= %w( __import__ abs all any apply basestring bin bool buffer bytearray bytes callable chr classmethod cmp coerce compile complex delattr dict dir divmod enumerate eval execfile exit file filter float frozenset getattr globals hasattr hash hex id input int intern isinstance issubclass iter len list locals long map max min next object oct open ord pow property range raw_input reduce reload repr reversed round set setattr slice sorted staticmethod str sum super tuple type unichr unicode vars xrange zip ) end def self.builtins_pseudo @builtins_pseudo ||= %w(self None Ellipsis NotImplemented False True) end def self.exceptions @exceptions ||= %w( ArithmeticError AssertionError AttributeError BaseException DeprecationWarning EOFError EnvironmentError Exception FloatingPointError FutureWarning GeneratorExit IOError ImportError ImportWarning IndentationError IndexError KeyError KeyboardInterrupt LookupError MemoryError NameError NotImplemented NotImplementedError OSError OverflowError OverflowWarning PendingDeprecationWarning ReferenceError RuntimeError RuntimeWarning StandardError StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TypeError UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning ValueError VMSError Warning WindowsError ZeroDivisionError ) end identifier = /[a-z_][a-z0-9_]*/i dotted_identifier = /[a-z_.][a-z0-9_.]*/i state :root do rule /\n+/m, Text rule /^(:)(\s*)([ru]{,2}""".*?""")/mi do groups Punctuation, Text, Str::Doc end rule /[^\S\n]+/, Text rule /#.*$/, Comment rule /[\[\]{}:(),;]/, Punctuation rule /\\\n/, Text rule /\\/, Text rule /(in|is|and|or|not)\b/, Operator::Word rule /!=|==|<<|>>|[-~+\/*%=<>&^|.]/, Operator rule /(from)((?:\\\s|\s)+)(#{dotted_identifier})((?:\\\s|\s)+)(import)/ do groups Keyword::Namespace, Text, Name::Namespace, Text, Keyword::Namespace end rule /(import)(\s+)(#{dotted_identifier})/ do groups Keyword::Namespace, Text, Name::Namespace end rule /(def)((?:\s|\\\s)+)/ do groups Keyword, Text push :funcname end rule /(class)((?:\s|\\\s)+)/ do groups Keyword, Text push :classname end # TODO: not in python 3 rule /`.*?`/, Str::Backtick rule /(?:r|ur|ru)"""/i, Str, :raw_tdqs rule /(?:r|ur|ru)'''/i, Str, :raw_tsqs rule /(?:r|ur|ru)"/i, Str, :raw_dqs rule /(?:r|ur|ru)'/i, Str, :raw_sqs rule /u?"""/i, Str, :tdqs rule /u?'''/i, Str, :tsqs rule /u?"/i, Str, :dqs rule /u?'/i, Str, :sqs rule /@#{dotted_identifier}/i, Name::Decorator # using negative lookbehind so we don't match property names rule /(?>= | >> | >= | > | \/ | \/= | := | % | %= | \.\.\. | \. | : /x SEPARATOR = / \( | \) | \[ | \] | \{ | \} | , | ; /x # Integer literals DECIMAL_LIT = /[0-9]#{DECIMAL_DIGIT}*/ OCTAL_LIT = /0#{OCTAL_DIGIT}*/ HEX_LIT = /0[xX]#{HEX_DIGIT}+/ INT_LIT = /#{HEX_LIT}|#{DECIMAL_LIT}|#{OCTAL_LIT}/ # Floating-point literals DECIMALS = /#{DECIMAL_DIGIT}+/ EXPONENT = /[eE][+\-]?#{DECIMALS}/ FLOAT_LIT = / #{DECIMALS} \. #{DECIMALS}? #{EXPONENT}? | #{DECIMALS} #{EXPONENT} | \. #{DECIMALS} #{EXPONENT}? /x # Imaginary literals IMAGINARY_LIT = /(?:#{DECIMALS}|#{FLOAT_LIT})i/ # Rune literals ESCAPED_CHAR = /\\[abfnrtv\\'"]/ LITTLE_U_VALUE = /\\u#{HEX_DIGIT}{4}/ BIG_U_VALUE = /\\U#{HEX_DIGIT}{8}/ UNICODE_VALUE = / #{UNICODE_CHAR} | #{LITTLE_U_VALUE} | #{BIG_U_VALUE} | #{ESCAPED_CHAR} /x OCTAL_BYTE_VALUE = /\\#{OCTAL_DIGIT}{3}/ HEX_BYTE_VALUE = /\\x#{HEX_DIGIT}{2}/ BYTE_VALUE = /#{OCTAL_BYTE_VALUE}|#{HEX_BYTE_VALUE}/ CHAR_LIT = /'(?:#{UNICODE_VALUE}|#{BYTE_VALUE})'/ ESCAPE_SEQUENCE = / #{ESCAPED_CHAR} | #{LITTLE_U_VALUE} | #{BIG_U_VALUE} | #{HEX_BYTE_VALUE} /x # String literals RAW_STRING_LIT = /`(?:#{UNICODE_CHAR}|#{NEWLINE})*`/ INTERPRETED_STRING_LIT = / "(?: (?!") (?: #{UNICODE_VALUE} | #{BYTE_VALUE} ) )*" /x STRING_LIT = /#{RAW_STRING_LIT}|#{INTERPRETED_STRING_LIT}/ # Predeclared identifiers PREDECLARED_TYPES = /\b(?: bool | byte | complex64 | complex128 | error | float32 | float64 | int8 | int16 | int32 | int64 | int | rune | string | uint8 | uint16 | uint32 | uint64 | uintptr | uint )\b/x PREDECLARED_CONSTANTS = /\b(?:true|false|iota|nil)\b/ PREDECLARED_FUNCTIONS = /\b(?: append | cap | close | complex | copy | delete | imag | len | make | new | panic | print | println | real | recover )\b/x state :simple_tokens do rule(COMMENT, Comment) rule(KEYWORD, Keyword) rule(PREDECLARED_TYPES, Keyword::Type) rule(PREDECLARED_FUNCTIONS, Name::Builtin) rule(PREDECLARED_CONSTANTS, Name::Constant) rule(IMAGINARY_LIT, Num) rule(FLOAT_LIT, Num) rule(INT_LIT, Num) rule(CHAR_LIT, Str::Char) rule(OPERATOR, Operator) rule(SEPARATOR, Punctuation) rule(IDENTIFIER, Name) rule(WHITE_SPACE, Other) end state :root do mixin :simple_tokens rule(/`/, Str, :raw_string) rule(/"/, Str, :interpreted_string) end state :interpreted_string do rule(ESCAPE_SEQUENCE, Str::Escape) rule(/\\./, Error) rule(/"/, Str, :pop!) rule(/[^"\\]+/, Str) end state :raw_string do rule(/`/, Str, :pop!) rule(/[^`]+/m, Str) end end end end rouge-2.2.1/lib/rouge/lexers/php.rb0000644000175000017500000001371113150713277017007 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class PHP < TemplateLexer title "PHP" desc "The PHP scripting language (php.net)" tag 'php' aliases 'php', 'php3', 'php4', 'php5' filenames '*.php', '*.php[345t]','*.phtml', # Support Drupal file extensions, see: # https://github.com/gitlabhq/gitlabhq/issues/8900 '*.module', '*.inc', '*.profile', '*.install', '*.test' mimetypes 'text/x-php' option :start_inline, 'Whether to start with inline php or require . (default: best guess)' option :funcnamehighlighting, 'Whether to highlight builtin functions (default: true)' option :disabledmodules, 'Disable certain modules from being highlighted as builtins (default: empty)' def initialize(*) super # if truthy, the lexer starts highlighting with php code # (no /, Comment::Preproc, :pop! # heredocs rule /<<<('?)(#{id})\1\n.*?\n\2;?\n/im, Str::Heredoc rule /\s+/, Text rule /#.*?\n/, Comment::Single rule %r(//.*?\n), Comment::Single # empty comment, otherwise seen as the start of a docstring rule %r(/\*\*/), Comment::Multiline rule %r(/\*\*.*?\*/)m, Str::Doc rule %r(/\*.*?\*/)m, Comment::Multiline rule /(->|::)(\s*)(#{id})/ do groups Operator, Text, Name::Attribute end rule /[~!%^&*+=\|:.<>\/?@-]+/, Operator rule /[\[\]{}();,]/, Punctuation rule /class\b/, Keyword, :classname # anonymous functions rule /(function)(\s*)(?=\()/ do groups Keyword, Text end # named functions rule /(function)(\s+)(&?)(\s*)/ do groups Keyword, Text, Operator, Text push :funcname end rule /(const)(\s+)(#{id})/i do groups Keyword, Text, Name::Constant end rule /(true|false|null)\b/, Keyword::Constant rule /\$\{\$+#{id}\}/i, Name::Variable rule /\$+#{id}/i, Name::Variable # may be intercepted for builtin highlighting rule /\\?#{nsid}/i do |m| name = m[0] if self.class.keywords.include? name token Keyword elsif self.builtins.include? name token Name::Builtin else token Name::Other end end rule /(\d+\.\d*|\d*\.\d+)(e[+-]?\d+)?/i, Num::Float rule /\d+e[+-]?\d+/i, Num::Float rule /0[0-7]+/, Num::Oct rule /0x[a-f0-9]+/i, Num::Hex rule /\d+/, Num::Integer rule /'([^'\\]*(?:\\.[^'\\]*)*)'/, Str::Single rule /`([^`\\]*(?:\\.[^`\\]*)*)`/, Str::Backtick rule /"/, Str::Double, :string end state :classname do rule /\s+/, Text rule /#{nsid}/, Name::Class, :pop! end state :funcname do rule /#{id}/, Name::Function, :pop! end state :string do rule /"/, Str::Double, :pop! rule /[^\\{$"]+/, Str::Double rule /\\([nrt\"$\\]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})/, Str::Escape rule /\$#{id}(\[\S+\]|->#{id})?/, Name::Variable rule /\{\$\{/, Str::Interpol, :interp_double rule /\{(?=\$)/, Str::Interpol, :interp_single rule /(\{)(\S+)(\})/ do groups Str::Interpol, Name::Variable, Str::Interpol end rule /[${\\]+/, Str::Double end state :interp_double do rule /\}\}/, Str::Interpol, :pop! mixin :php end state :interp_single do rule /\}/, Str::Interpol, :pop! mixin :php end end end end rouge-2.2.1/lib/rouge/lexers/factor.rb0000644000175000017500000002760613150713277017506 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Factor < RegexLexer title "Factor" desc "Factor, the practical stack language (factorcode.org)" tag 'factor' filenames '*.factor' mimetypes 'text/x-factor' def self.analyze_text(text) return 1 if text.shebang? 'factor' end def self.builtins @builtins ||= {}.tap do |builtins| builtins[:kernel] = Set.new %w( or 2bi 2tri while wrapper nip 4dip wrapper? bi* callstack>array both? hashcode die dupd callstack callstack? 3dup tri@ pick curry build ?execute 3bi prepose >boolean if clone eq? tri* ? = swapd 2over 2keep 3keep clear 2dup when not tuple? dup 2bi* 2tri* call tri-curry object bi@ do unless* if* loop bi-curry* drop when* assert= retainstack assert? -rot execute 2bi@ 2tri@ boa with either? 3drop bi curry? datastack until 3dip over 3curry tri-curry* tri-curry@ swap and 2nip throw bi-curry (clone) hashcode* compose 2dip if 3tri unless compose? tuple keep 2curry equal? assert tri 2drop most boolean? identity-hashcode identity-tuple? null new dip bi-curry@ rot xor identity-tuple boolean ) builtins[:assocs] = Set.new %w( ?at assoc? assoc-clone-like assoc= delete-at* assoc-partition extract-keys new-assoc value? assoc-size map>assoc push-at assoc-like key? assoc-intersect assoc-refine update assoc-union assoc-combine at* assoc-empty? at+ set-at assoc-all? assoc-subset? assoc-hashcode change-at assoc-each assoc-diff zip values value-at rename-at inc-at enum? at cache assoc>map assoc assoc-map enum value-at* assoc-map-as >alist assoc-filter-as clear-assoc assoc-stack maybe-set-at substitute assoc-filter 2cache delete-at assoc-find keys assoc-any? unzip ) builtins[:combinators] = Set.new %w( case execute-effect no-cond no-case? 3cleave>quot 2cleave cond>quot wrong-values? no-cond? cleave>quot no-case case>quot 3cleave wrong-values to-fixed-point alist>quot case-find cond cleave call-effect 2cleave>quot recursive-hashcode linear-case-quot spread spread>quot ) builtins[:math] = Set.new %w( number= if-zero next-power-of-2 each-integer ?1+ fp-special? imaginary-part unless-zero float>bits number? fp-infinity? bignum? fp-snan? denominator fp-bitwise= * + power-of-2? - u>= / >= bitand log2-expects-positive < log2 > integer? number bits>double 2/ zero? (find-integer) bits>float float? shift ratio? even? ratio fp-sign bitnot >fixnum complex? /i /f byte-array>bignum when-zero sgn >bignum next-float u< u> mod recip rational find-last-integer >float (all-integers?) 2^ times integer fixnum? neg fixnum sq bignum (each-integer) bit? fp-qnan? find-integer complex real double>bits bitor rem fp-nan-payload all-integers? real-part log2-expects-positive? prev-float align unordered? float fp-nan? abs bitxor u<= odd? <= /mod rational? >integer real? numerator ) builtins[:sequences] = Set.new %w( member-eq? append assert-sequence= find-last-from trim-head-slice clone-like 3sequence assert-sequence? map-as last-index-from reversed index-from cut* pad-tail remove-eq! concat-as but-last snip trim-tail nths nth 2selector sequence slice? partition remove-nth tail-slice empty? tail* if-empty find-from virtual-sequence? member? set-length drop-prefix unclip unclip-last-slice iota map-sum bounds-error? sequence-hashcode-step selector-for accumulate-as map start midpoint@ (accumulate) rest-slice prepend fourth sift accumulate! new-sequence follow map! like first4 1sequence reverse slice unless-empty padding virtual@ repetition? set-last index 4sequence max-length set-second immutable-sequence first2 first3 replicate-as reduce-index unclip-slice supremum suffix! insert-nth trim-tail-slice tail 3append short count suffix concat flip filter sum immutable? reverse! 2sequence map-integers delete-all start* indices snip-slice check-slice sequence? head map-find filter! append-as reduce sequence= halves collapse-slice interleave 2map filter-as binary-reduce slice-error? product bounds-check? bounds-check harvest immutable virtual-exemplar find produce remove pad-head last replicate set-fourth remove-eq shorten reversed? map-find-last 3map-as 2unclip-slice shorter? 3map find-last head-slice pop* 2map-as tail-slice* but-last-slice 2map-reduce iota? collector-for accumulate each selector append! new-resizable cut-slice each-index head-slice* 2reverse-each sequence-hashcode pop set-nth ?nth second join when-empty collector immutable-sequence? all? 3append-as virtual-sequence subseq? remove-nth! push-either new-like length last-index push-if 2all? lengthen assert-sequence copy map-reduce move third first 3each tail? set-first prefix bounds-error any? trim-slice exchange surround 2reduce cut change-nth min-length set-third produce-as push-all head? delete-slice rest sum-lengths 2each head* infimum remove! glue slice-error subseq trim replace-slice push repetition map-index trim-head unclip-last mismatch ) builtins[:namespaces] = Set.new %w( global +@ change set-namestack change-global init-namespaces on off set-global namespace set with-scope bind with-variable inc dec counter initialize namestack get get-global make-assoc ) builtins[:arrays] = Set.new %w( 2array 3array pair >array 1array 4array pair? array resize-array array? ) builtins[:io] = Set.new %w( +character+ bad-seek-type? readln each-morsel stream-seek read print with-output-stream contents write1 stream-write1 stream-copy stream-element-type with-input-stream stream-print stream-read stream-contents stream-tell tell-output bl seek-output bad-seek-type nl stream-nl write flush stream-lines +byte+ stream-flush read1 seek-absolute? stream-read1 lines stream-readln stream-read-until each-line seek-end with-output-stream* seek-absolute with-streams seek-input seek-relative? input-stream stream-write read-partial seek-end? seek-relative error-stream read-until with-input-stream* with-streams* tell-input each-block output-stream stream-read-partial each-stream-block each-stream-line ) builtins[:strings] = Set.new %w( resize-string >string 1string string string? ) builtins[:vectors] = Set.new %w( with-return restarts return-continuation with-datastack recover rethrow-restarts ifcc set-catchstack >continuation< cleanup ignore-errors restart? compute-restarts attempt-all-error error-thread continue attempt-all-error? condition? throw-restarts error catchstack continue-with thread-error-hook continuation rethrow callcc1 error-continuation callcc0 attempt-all condition continuation? restart return ) builtins[:continuations] = Set.new %w( with-return restarts return-continuation with-datastack recover rethrow-restarts ifcc set-catchstack >continuation< cleanup ignore-errors restart? compute-restarts attempt-all-error error-thread continue attempt-all-error? condition? throw-restarts error catchstack continue-with thread-error-hook continuation rethrow callcc1 error-continuation callcc0 attempt-all condition continuation? restart return ) end end state :root do rule /\s+/m, Text rule /(:|::|MACRO:|MEMO:|GENERIC:|HELP:)(\s+)(\S+)/m do groups Keyword, Text, Name::Function end rule /(M:|HOOK:|GENERIC#)(\s+)(\S+)(\s+)(\S+)/m do groups Keyword, Text, Name::Class, Text, Name::Function end rule /\((?=\s)/, Name::Function, :stack_effect rule /;(?=\s)/, Keyword rule /(USING:)((?:\s|\\\s)+)/m do groups Keyword::Namespace, Text push :import end rule /(IN:|USE:|UNUSE:|QUALIFIED:|QUALIFIED-WITH:)(\s+)(\S+)/m do groups Keyword::Namespace, Text, Name::Namespace end rule /(FROM:|EXCLUDE:)(\s+)(\S+)(\s+)(=>)/m do groups Keyword::Namespace, Text, Name::Namespace, Text, Punctuation end rule /(?:ALIAS|DEFER|FORGET|POSTPONE):/, Keyword::Namespace rule /(TUPLE:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)/m do groups( Keyword, Text, Name::Class, Text, Punctuation, Text, Name::Class ) push :slots end rule /(TUPLE:)(\s+)(\S+)/m do groups Keyword, Text, Name::Class push :slots end rule /(UNION:|INTERSECTION:)(\s+)(\S+)/m do groups Keyword, Text, Name::Class end rule /(PREDICATE:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)/m do groups( Keyword, Text, Name::Class, Text, Punctuation, Text, Name::Class ) end rule /(C:)(\s+)(\S+)(\s+)(\S+)/m do groups( Keyword, Text, Name::Function, Text, Name::Class ) end rule %r( (INSTANCE|SLOT|MIXIN|SINGLETONS?|CONSTANT|SYMBOLS?|ERROR|SYNTAX |ALIEN|TYPEDEF|FUNCTION|STRUCT): )x, Keyword rule /(?:)/, Keyword::Namespace rule /(MAIN:)(\s+)(\S+)/ do groups Keyword::Namespace, Text, Name::Function end # strings rule /"""\s+.*?\s+"""/, Str rule /"(\\.|[^\\])*?"/, Str rule /(CHAR:)(\s+)(\\[\\abfnrstv]*|\S)(?=\s)/, Str::Char # comments rule /!\s+.*$/, Comment rule /#!\s+.*$/, Comment # booleans rule /[tf](?=\s)/, Name::Constant # numbers rule /-?\d+\.\d+(?=\s)/, Num::Float rule /-?\d+(?=\s)/, Num::Integer rule /HEX:\s+[a-fA-F\d]+(?=\s)/m, Num::Hex rule /BIN:\s+[01]+(?=\s)/, Num::Bin rule /OCT:\s+[0-7]+(?=\s)/, Num::Oct rule %r([-+/*=<>^](?=\s)), Operator rule /(?:deprecated|final|foldable|flushable|inline|recursive)(?=\s)/, Keyword rule /\S+/ do |m| name = m[0] if self.class.builtins.values.any? { |b| b.include? name } token Name::Builtin else token Name end end end state :stack_effect do rule /\s+/, Text rule /\(/, Name::Function, :stack_effect rule /\)/, Name::Function, :pop! rule /--/, Name::Function rule /\S+/, Name::Variable end state :slots do rule /\s+/, Text rule /;(?=\s)/, Keyword, :pop! rule /\S+/, Name::Variable end state :import do rule /;(?=\s)/, Keyword, :pop! rule /\s+/, Text rule /\S+/, Name::Namespace end end end end rouge-2.2.1/lib/rouge/lexers/sass.rb0000644000175000017500000000304313150713277017166 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers load_lexer 'sass/common.rb' class Sass < SassCommon include Indentation title "Sass" desc 'The Sass stylesheet language language (sass-lang.com)' tag 'sass' filenames '*.sass' mimetypes 'text/x-sass' id = /[\w-]+/ state :root do rule /[ \t]*\n/, Text rule(/[ \t]*/) { |m| token Text; indentation(m[0]) } end state :content do # block comments rule %r(//.*?\n) do token Comment::Single pop!; starts_block :single_comment end rule %r(/[*].*?\n) do token Comment::Multiline pop!; starts_block :multi_comment end rule /@import\b/, Keyword, :import mixin :content_common rule %r(=#{id}), Name::Function, :value rule %r([+]#{id}), Name::Decorator, :value rule /:/, Name::Attribute, :old_style_attr rule(/(?=.+?:([^a-z]|$))/) { push :attribute } rule(//) { push :selector } end state :single_comment do rule /.*?\n/, Comment::Single, :pop! end state :multi_comment do rule /.*?\n/, Comment::Multiline, :pop! end state :import do rule /[ \t]+/, Text rule /\S+/, Str rule /\n/, Text, :pop! end state :old_style_attr do mixin :attr_common rule(//) { pop!; push :value } end state :end_section do rule(/\n/) { token Text; reset_stack } end end end end rouge-2.2.1/lib/rouge/lexers/javascript.rb0000644000175000017500000001627313150713277020374 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers # IMPORTANT NOTICE: # # Please do not copy this lexer and open a pull request # for a new language. It will not get merged, you will # be unhappy, and kittens will cry. # class Javascript < RegexLexer title "JavaScript" desc "JavaScript, the browser scripting language" tag 'javascript' aliases 'js' filenames '*.js' mimetypes 'application/javascript', 'application/x-javascript', 'text/javascript', 'text/x-javascript' def self.analyze_text(text) return 1 if text.shebang?('node') return 1 if text.shebang?('jsc') # TODO: rhino, spidermonkey, etc end state :multiline_comment do rule %r([*]/), Comment::Multiline, :pop! rule %r([^*/]+), Comment::Multiline rule %r([*/]), Comment::Multiline end state :comments_and_whitespace do rule /\s+/, Text rule / rule /--(?![!#\$\%&*+.\/<=>?@\^\|_~]).*?$/, Comment::Single end # nested commenting state :comment do rule /-}/, Comment::Multiline, :pop! rule /{-/, Comment::Multiline, :comment rule /[^-{}]+/, Comment::Multiline rule /[-{}]/, Comment::Multiline end state :comment_preproc do rule /-}/, Comment::Preproc, :pop! rule /{-/, Comment::Preproc, :comment rule /[^-{}]+/, Comment::Preproc rule /[-{}]/, Comment::Preproc end state :root do mixin :basic rule /\bimport\b/, Keyword::Reserved, :import rule /\bmodule\b/, Keyword::Reserved, :module rule /\berror\b/, Name::Exception rule /\b(?:#{reserved.join('|')})\b/, Keyword::Reserved # not sure why, but ^ doesn't work here # rule /^[_a-z][\w']*/, Name::Function rule /[_a-z][\w']*/, Name rule /[A-Z][\w']*/, Keyword::Type # lambda operator rule %r(\\(?![:!#\$\%&*+.\\/<=>?@^\|~-]+)), Name::Function # special operators rule %r((<-|::|->|=>|=)(?![:!#\$\%&*+.\\/<=>?@^\|~-]+)), Operator # constructor/type operators rule %r(:[:!#\$\%&*+.\\/<=>?@^\|~-]*), Operator # other operators rule %r([:!#\$\%&*+.\\/<=>?@^\|~-]+), Operator rule /\d+e[+-]?\d+/i, Num::Float rule /\d+\.\d+(e[+-]?\d+)?/i, Num::Float rule /0o[0-7]+/i, Num::Oct rule /0x[\da-f]+/i, Num::Hex rule /\d+/, Num::Integer rule /'/, Str::Char, :character rule /"/, Str, :string rule /\[\s*\]/, Keyword::Type rule /\(\s*\)/, Name::Builtin rule /[\[\](),;`{}]/, Punctuation end state :import do rule /\s+/, Text rule /"/, Str, :string rule /\bqualified\b/, Keyword # import X as Y rule /([A-Z][\w.]*)(\s+)(as)(\s+)([A-Z][a-zA-Z0-9_.]*)/ do groups( Name::Namespace, # X Text, Keyword, # as Text, Name # Y ) pop! end # import X hiding (functions) rule /([A-Z][\w.]*)(\s+)(hiding)(\s+)(\()/ do groups( Name::Namespace, # X Text, Keyword, # hiding Text, Punctuation # ( ) goto :funclist end # import X (functions) rule /([A-Z][\w.]*)(\s+)(\()/ do groups( Name::Namespace, # X Text, Punctuation # ( ) goto :funclist end rule /[\w.]+/, Name::Namespace, :pop! end state :module do rule /\s+/, Text # module Foo (functions) rule /([A-Z][\w.]*)(\s+)(\()/ do groups Name::Namespace, Text, Punctuation push :funclist end rule /\bwhere\b/, Keyword::Reserved, :pop! rule /[A-Z][a-zA-Z0-9_.]*/, Name::Namespace, :pop! end state :funclist do mixin :basic rule /[A-Z]\w*/, Keyword::Type rule /(_[\w\']+|[a-z][\w\']*)/, Name::Function rule /,/, Punctuation rule /[:!#\$\%&*+.\\\/<=>?@^\|~-]+/, Operator rule /\(/, Punctuation, :funclist rule /\)/, Punctuation, :pop! end state :character do rule /\\/ do token Str::Escape push :character_end push :escape end rule /./ do token Str::Char goto :character_end end end state :character_end do rule /'/, Str::Char, :pop! rule /./, Error, :pop! end state :string do rule /"/, Str, :pop! rule /\\/, Str::Escape, :escape rule /[^\\"]+/, Str end state :escape do rule /[abfnrtv"'&\\]/, Str::Escape, :pop! rule /\^[\]\[A-Z@\^_]/, Str::Escape, :pop! rule /#{ascii.join('|')}/, Str::Escape, :pop! rule /o[0-7]+/i, Str::Escape, :pop! rule /x[\da-f]/i, Str::Escape, :pop! rule /\d+/, Str::Escape, :pop! rule /\s+\\/, Str::Escape, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/nim.rb0000644000175000017500000001105413150713277017001 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Nim < RegexLexer # This is pretty much a 1-1 port of the pygments NimrodLexer class title "Nim" desc "The Nim programming language (http://nim-lang.org/)" tag 'nim' aliases 'nimrod' filenames '*.nim' KEYWORDS = %w( addr as asm atomic bind block break case cast const continue converter defer discard distinct do elif else end enum except export func finally for from generic if import include interface iterator let macro method mixin nil object of out proc ptr raise ref return static template try tuple type using var when while with without yield ) OPWORDS = %w( and or not xor shl shr div mod in notin is isnot ) PSEUDOKEYWORDS = %w( nil true false ) TYPES = %w( int int8 int16 int32 int64 float float32 float64 bool char range array seq set string ) NAMESPACE = %w( from import include ) def self.underscorize(words) words.map do |w| w.gsub(/./) { |x| "#{Regexp.escape(x)}_?" } end.join('|') end state :chars do rule(/\\([\\abcefnrtvl"\']|x[a-fA-F0-9]{2}|[0-9]{1,3})/, Str::Escape) rule(/'/, Str::Char, :pop!) rule(/./, Str::Char) end state :strings do rule(/(?|<|\+|-|\/|@|\$|~|&|%|\!|\?|\||\\|\[|\]/, Operator) rule(/\.\.|\.|,|\[\.|\.\]|{\.|\.}|\(\.|\.\)|{|}|\(|\)|:|\^|`|;/, Punctuation) # Strings rule(/(?:[\w]+)"/,Str, :rdqs) rule(/"""/, Str, :tdqs) rule(/"/, Str, :dqs) # Char rule(/'/, Str::Char, :chars) # Keywords rule(%r[(#{Nim.underscorize(OPWORDS)})\b], Operator::Word) rule(/(p_?r_?o_?c_?\s)(?![\(\[\]])/, Keyword, :funcname) rule(%r[(#{Nim.underscorize(KEYWORDS)})\b], Keyword) rule(%r[(#{Nim.underscorize(NAMESPACE)})\b], Keyword::Namespace) rule(/(v_?a_?r)\b/, Keyword::Declaration) rule(%r[(#{Nim.underscorize(TYPES)})\b], Keyword::Type) rule(%r[(#{Nim.underscorize(PSEUDOKEYWORDS)})\b], Keyword::Pseudo) # Identifiers rule(/\b((?![_\d])\w)(((?!_)\w)|(_(?!_)\w))*/, Name) # Numbers # Note: Have to do this with a block to push multiple states first, # since we can't pass array of states like w/ Pygments. rule(/[0-9][0-9_]*(?=([eE.]|'?[fF](32|64)))/) do |number| push :floatsuffix push :floatnumber token Num::Float end rule(/0[xX][a-fA-F0-9][a-fA-F0-9_]*/, Num::Hex, :intsuffix) rule(/0[bB][01][01_]*/, Num, :intsuffix) rule(/0o[0-7][0-7_]*/, Num::Oct, :intsuffix) rule(/[0-9][0-9_]*/, Num::Integer, :intsuffix) # Whitespace rule(/\s+/, Text) rule(/.+$/, Error) end end end end rouge-2.2.1/lib/rouge/lexers/smalltalk.rb0000644000175000017500000000602013150713277020177 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Smalltalk < RegexLexer title "Smalltalk" desc 'The Smalltalk programming language' tag 'smalltalk' aliases 'st', 'squeak' filenames '*.st' mimetypes 'text/x-smalltalk' ops = %r([-+*/\\~<>=|&!?,@%]) state :root do rule /(<)(\w+:)(.*?)(>)/ do groups Punctuation, Keyword, Text, Punctuation end # mixin :squeak_fileout mixin :whitespaces mixin :method_definition rule /([|])([\w\s]*)([|])/ do groups Punctuation, Name::Variable, Punctuation end mixin :objects rule /\^|:=|_/, Operator rule /[)}\]]/, Punctuation, :after_object rule /[({\[!]/, Punctuation end state :method_definition do rule /([a-z]\w*:)(\s*)(\w+)/i do groups Name::Function, Text, Name::Variable end rule /^(\s*)(\b[a-z]\w*\b)(\s*)$/i do groups Text, Name::Function, Text end rule %r(^(\s*)(#{ops}+)(\s*)(\w+)(\s*)$) do groups Text, Name::Function, Text, Name::Variable, Text end end state :block_variables do mixin :whitespaces rule /(:)(\s*)(\w+)/ do groups Operator, Text, Name::Variable end rule /[|]/, Punctuation, :pop! rule(//) { pop! } end state :literals do rule /'(''|.)*?'/m, Str, :after_object rule /[$]./, Str::Char, :after_object rule /#[(]/, Str::Symbol, :parenth rule /(\d+r)?-?\d+(\.\d+)?(e-?\d+)?/, Num, :after_object rule /#("[^"]*"|#{ops}+|[\w:]+)/, Str::Symbol, :after_object end state :parenth do rule /[)]/ do token Str::Symbol goto :after_object end mixin :inner_parenth end state :inner_parenth do rule /#[(]/, Str::Symbol, :inner_parenth rule /[)]/, Str::Symbol, :pop! mixin :whitespaces mixin :literals rule /(#{ops}|[\w:])+/, Str::Symbol end state :whitespaces do rule /! !$/, Keyword # squeak chunk delimiter rule /\s+/m, Text rule /".*?"/m, Comment end state :objects do rule /\[/, Punctuation, :block_variables rule /(self|super|true|false|nil|thisContext)\b/, Name::Builtin::Pseudo, :after_object rule /[A-Z]\w*(?!:)\b/, Name::Class, :after_object rule /[a-z]\w*(?!:)\b/, Name::Variable, :after_object mixin :literals end state :after_object do mixin :whitespaces rule /(ifTrue|ifFalse|whileTrue|whileFalse|timesRepeat):/, Name::Builtin, :pop! rule /new(?!:)\b/, Name::Builtin rule /:=|_/, Operator, :pop! rule /[a-z]+\w*:/i, Name::Function, :pop! rule /[a-z]+\w*/i, Name::Function rule /#{ops}+/, Name::Function, :pop! rule /[.]/, Punctuation, :pop! rule /;/, Punctuation rule(//) { pop! } end end end end rouge-2.2.1/lib/rouge/lexers/sml.rb0000644000175000017500000002015113150713277017007 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class SML < RegexLexer title "SML" desc 'Standard ML' tag 'sml' aliases 'ml' filenames '*.sml', '*.sig', '*.fun' mimetypes 'text/x-standardml', 'application/x-standardml' def self.keywords @keywords ||= Set.new %w( abstype and andalso as case datatype do else end exception fn fun handle if in infix infixr let local nonfix of op open orelse raise rec then type val with withtype while eqtype functor include sharing sig signature struct structure where ) end def self.symbolic_reserved @symbolic_reserved ||= Set.new %w(: | = => -> # :>) end id = /[\w']+/i symbol = %r([!%&$#/:<=>?@\\~`^|*+-]+) def self.analyze_text(text) return 0 end state :whitespace do rule /\s+/m, Text rule /[(][*]/, Comment, :comment end state :delimiters do rule /[(\[{]/, Punctuation, :main rule /[)\]}]/, Punctuation, :pop! rule /\b(let|if|local)\b(?!')/ do token Keyword::Reserved push; push end rule /\b(struct|sig|while)\b(?!')/ do token Keyword::Reserved push end rule /\b(do|else|end|in|then)\b(?!')/, Keyword::Reserved, :pop! end def token_for_id_with_dot(id) if self.class.keywords.include? id Error else Name::Namespace end end def token_for_final_id(id) if self.class.keywords.include? id or self.class.symbolic_reserved.include? id Error else Name end end def token_for_id(id) if self.class.keywords.include? id Keyword::Reserved elsif self.class.symbolic_reserved.include? id Punctuation else Name end end state :core do rule /[()\[\]{},;_]|[.][.][.]/, Punctuation rule /#"/, Str::Char, :char rule /"/, Str::Double, :string rule /~?0x[0-9a-fA-F]+/, Num::Hex rule /0wx[0-9a-fA-F]+/, Num::Hex rule /0w\d+/, Num::Integer rule /~?\d+([.]\d+)?[eE]~?\d+/, Num::Float rule /~?\d+[.]\d+/, Num::Float rule /~?\d+/, Num::Integer rule /#\s*[1-9][0-9]*/, Name::Label rule /#\s*#{id}/, Name::Label rule /#\s+#{symbol}/, Name::Label rule /\b(datatype|abstype)\b(?!')/, Keyword::Reserved, :dname rule(/(?=\bexception\b(?!'))/) { push :ename } rule /\b(functor|include|open|signature|structure)\b(?!')/, Keyword::Reserved, :sname rule /\b(type|eqtype)\b(?!')/, Keyword::Reserved, :tname rule /'#{id}/, Name::Decorator rule /(#{id})([.])/ do |m| groups(token_for_id_with_dot(m[1]), Punctuation) push :dotted end rule id do |m| token token_for_id(m[0]) end rule symbol do |m| token token_for_id(m[0]) end end state :dotted do rule /(#{id})([.])/ do |m| groups(token_for_id_with_dot(m[1]), Punctuation) end rule id do |m| token token_for_id(m[0]) pop! end rule symbol do |m| token token_for_id(m[0]) pop! end end state :root do rule /#!.*?\n/, Comment::Preproc rule(//) { push :main } end state :main do mixin :whitespace rule /\b(val|and)\b(?!')/, Keyword::Reserved, :vname rule /\b(fun)\b(?!')/ do token Keyword::Reserved goto :main_fun push :fname end mixin :delimiters mixin :core end state :main_fun do mixin :whitespace rule /\b(fun|and)\b(?!')/, Keyword::Reserved, :fname rule /\bval\b(?!')/ do token Keyword::Reserved goto :main push :vname end rule /[|]/, Punctuation, :fname rule /\b(case|handle)\b(?!')/ do token Keyword::Reserved goto :main end mixin :delimiters mixin :core end state :has_escapes do rule /\\[\\"abtnvfr]/, Str::Escape rule /\\\^[\x40-\x5e]/, Str::Escape rule /\\[0-9]{3}/, Str::Escape rule /\\u\h{4}/, Str::Escape rule /\\\s+\\/, Str::Interpol end state :string do rule /[^"\\]+/, Str::Double rule /"/, Str::Double, :pop! mixin :has_escapes end state :char do rule /[^"\\]+/, Str::Char rule /"/, Str::Char, :pop! mixin :has_escapes end state :breakout do rule /(?=\b(#{SML.keywords.to_a.join('|')})\b(?!'))/ do pop! end end state :sname do mixin :whitespace mixin :breakout rule id, Name::Namespace rule(//) { pop! } end state :has_annotations do rule /'[\w']*/, Name::Decorator rule /[(]/, Punctuation, :tyvarseq end state :fname do mixin :whitespace mixin :has_annotations rule id, Name::Function, :pop! rule symbol, Name::Function, :pop! end state :vname do mixin :whitespace mixin :has_annotations rule /(#{id})(\s*)(=(?!#{symbol}))/m do groups Name::Variable, Text, Punctuation pop! end rule /(#{symbol})(\s*)(=(?!#{symbol}))/m do groups Name::Variable, Text, Punctuation end rule id, Name::Variable, :pop! rule symbol, Name::Variable, :pop! rule(//) { pop! } end state :tname do mixin :whitespace mixin :breakout mixin :has_annotations rule /'[\w']*/, Name::Decorator rule /[(]/, Punctuation, :tyvarseq rule %r(=(?!#{symbol})) do token Punctuation goto :typbind end rule id, Keyword::Type rule symbol, Keyword::Type end state :typbind do mixin :whitespace rule /\b(and)\b(?!')/ do token Keyword::Reserved goto :tname end mixin :breakout mixin :core end state :dname do mixin :whitespace mixin :breakout mixin :has_annotations rule /(=)(\s*)(datatype)\b/ do groups Punctuation, Text, Keyword::Reserved pop! end rule %r(=(?!#{symbol})) do token Punctuation goto :datbind push :datcon end rule id, Keyword::Type rule symbol, Keyword::Type end state :datbind do mixin :whitespace rule /\b(and)\b(?!')/ do token Keyword::Reserved; goto :dname end rule /\b(withtype)\b(?!')/ do token Keyword::Reserved; goto :tname end rule /\bof\b(?!')/, Keyword::Reserved rule /([|])(\s*)(#{id})/ do groups(Punctuation, Text, Name::Class) end rule /([|])(\s+)(#{symbol})/ do groups(Punctuation, Text, Name::Class) end mixin :breakout mixin :core end state :ename do mixin :whitespace rule /(exception|and)(\s+)(#{id})/ do groups Keyword::Reserved, Text, Name::Class end rule /(exception|and)(\s*)(#{symbol})/ do groups Keyword::Reserved, Text, Name::Class end rule /\b(of)\b(?!')/, Keyword::Reserved mixin :breakout mixin :core end state :datcon do mixin :whitespace rule id, Name::Class, :pop! rule symbol, Name::Class, :pop! end state :tyvarseq do mixin :whitespace rule /'[\w']*/, Name::Decorator rule id, Name rule /,/, Punctuation rule /[)]/, Punctuation, :pop! rule symbol, Name end state :comment do rule /[^(*)]+/, Comment::Multiline rule /[(][*]/ do token Comment::Multiline; push end rule /[*][)]/, Comment::Multiline, :pop! rule /[(*)]/, Comment::Multiline end end end end rouge-2.2.1/lib/rouge/lexers/fortran.rb0000644000175000017500000001626013150713277017675 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # # vim: set ts=2 sw=2 et: # TODO: Implement format list support. module Rouge module Lexers class Fortran < RegexLexer title "Fortran" desc "Fortran 2008 (free-form)" tag 'fortran' filenames '*.f90', '*.f95', '*.f03', '*.f08', '*.F90', '*.F95', '*.F03', '*.F08' mimetypes 'text/x-fortran' name = /[A-Z][_A-Z0-9]*/i kind_param = /(\d+|#{name})/ exponent = /[ED][+-]?\d+/i def self.keywords # Special rules for two-word keywords are defined further down. # Note: Fortran allows to omit whitespace between certain keywords. @keywords ||= Set.new %w( abstract allocatable allocate assign assignment associate asynchronous backspace bind block blockdata call case class close codimension common concurrent contains contiguous continue critical cycle data deallocate deferred dimension do elemental else elseif elsewhere end endassociate endblock endblockdata enddo endenum endfile endforall endfunction endif endinterface endmodule endprogram endselect endsubmodule endsubroutine endtype endwhere endwhile entry enum enumerator equivalence exit extends external final flush forall format function generic goto if implicit import in include inout inquire intent interface intrinsic is lock module namelist non_overridable none nopass nullify only open operator optional out parameter pass pause pointer print private procedure program protected public pure read recursive result return rewind save select selectcase sequence stop submodule subroutine target then type unlock use value volatile wait where while write ) end def self.types # A special rule for the two-word version "double precision" is # defined further down. @types ||= Set.new %w( character complex doubleprecision integer logical real ) end def self.intrinsics @intrinsics ||= Set.new %w( abs achar acos acosh adjustl adjustr aimag aint all allocated anint any asin asinh associated atan atan2 atanh atomic_define atomic_ref bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn bge bgt bit_size ble blt btest c_associated c_f_pointer c_f_procpointer c_funloc c_loc c_sizeof ceiling char cmplx command_argument_count compiler_options compiler_version conjg cos cosh count cpu_time cshift date_and_time dble digits dim dot_product dprod dshiftl dshiftr eoshift epsilon erf erfc_scaled erfc execute_command_line exp exponent extends_type_of findloc floor fraction gamma get_command_argument get_command get_environment_variable huge hypot iachar iall iand iany ibclr ibits ibset ichar ieee_class ieee_copy_sign ieee_get_flag ieee_get_halting_mode ieee_get_rounding_mode ieee_get_status ieee_get_underflow_mode ieee_is_finite ieee_is_nan ieee_is_normal ieee_logb ieee_next_after ieee_rem ieee_rint ieee_scalb ieee_selected_real_kind ieee_set_flag ieee_set_halting_mode ieee_set_rounding_mode ieee_set_status ieee_set_underflow_mode ieee_support_datatype ieee_support_denormal ieee_support_divide ieee_support_flag ieee_support_halting ieee_support_inf ieee_support_io ieee_support_nan ieee_support_rounding ieee_support_sqrt ieee_support_standard ieee_support_underflow_control ieee_unordered ieee_value ieor image_index index int ior iparity is_contiguous is_iostat_end is_iostat_eor ishft ishftc kind lbound lcobound leadz len_trim len lge lgt lle llt log_gamma log log10 logical maskl maskr matmul max maxexponent maxloc maxval merge_bits merge min minexponent minloc minval mod modulo move_alloc mvbits nearest new_line nint norm2 not null num_images pack parity popcnt poppar present product radix random_number random_seed range real repeat reshape rrspacing same_type_as scale scan selected_char_kind selected_int_kind selected_real_kind set_exponent shape shifta shiftl shiftr sign sin sinh size spacing spread sqrt storage_size sum system_clock tan tanh this_image tiny trailz transfer transpose trim ubound ucobound unpack verify ) end state :root do rule /[\s\n]+/, Text::Whitespace rule /!.*$/, Comment::Single rule /^#.*$/, Comment::Preproc rule /::|[()\/;,:&\[\]]/, Punctuation # TODO: This does not take into account line continuation. rule /^(\s*)([0-9]+)\b/m do |m| token Text::Whitespace, m[1] token Name::Label, m[2] end # Format statements are quite a strange beast. # Better process them in their own state. rule /\b(FORMAT)(\s*)(\()/mi do |m| token Keyword, m[1] token Text::Whitespace, m[2] token Punctuation, m[3] push :format_spec end rule %r( [+-]? # sign ( (\d+[.]\d*|[.]\d+)(#{exponent})? | \d+#{exponent} # exponent is mandatory ) (_#{kind_param})? # kind parameter )xi, Num::Float rule /[+-]?\d+(_#{kind_param})?/i, Num::Integer rule /B'[01]+'|B"[01]+"/i, Num::Bin rule /O'[0-7]+'|O"[0-7]+"/i, Num::Oct rule /Z'[0-9A-F]+'|Z"[0-9A-F]+"/i, Num::Hex rule /(#{kind_param}_)?'/, Str::Single, :string_single rule /(#{kind_param}_)?"/, Str::Double, :string_double rule /[.](TRUE|FALSE)[.](_#{kind_param})?/i, Keyword::Constant rule %r{\*\*|//|==|/=|<=|>=|=>|[-+*/<>=%]}, Operator rule /\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV|[A-Z]+)\./i, Operator::Word # Special rules for two-word keywords and types. # Note: "doubleprecision" is covered by the normal keyword rule. rule /double\s+precision\b/i, Keyword::Type rule /go\s+to\b/i, Keyword rule /sync\s+(all|images|memory)\b/i, Keyword rule /error\s+stop\b/i, Keyword rule /#{name}/m do |m| match = m[0].downcase if self.class.keywords.include? match token Keyword elsif self.class.types.include? match token Keyword::Type elsif self.class.intrinsics.include? match token Name::Builtin else token Name end end end state :string_single do rule /[^']+/, Str::Single rule /''/, Str::Escape rule /'/, Str::Single, :pop! end state :string_double do rule /[^"]+/, Str::Double rule /""/, Str::Escape rule /"/, Str::Double, :pop! end state :format_spec do rule /'/, Str::Single, :string_single rule /"/, Str::Double, :string_double rule /\(/, Punctuation, :format_spec rule /\)/, Punctuation, :pop! rule /,/, Punctuation rule /[\s\n]+/, Text::Whitespace # Edit descriptors could be seen as a kind of "format literal". rule /[^\s'"(),]+/, Literal end end end end rouge-2.2.1/lib/rouge/lexers/liquid.rb0000644000175000017500000001472213150713277017512 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Liquid < RegexLexer title "Liquid" desc 'Liquid is a templating engine for Ruby (liquidmarkup.org)' tag 'liquid' filenames '*.liquid' state :root do rule /[^\{]+/, Text rule /(\{%)(\s*)/ do groups Punctuation, Text::Whitespace push :tag_or_block end rule /(\{\{)(\s*)/ do groups Punctuation, Text::Whitespace push :output end rule /\{/, Text end state :tag_or_block do # builtin logic blocks rule /(if|unless|elsif|case)(?=\s+)/, Keyword::Reserved, :condition rule /(when)(\s+)/ do groups Keyword::Reserved, Text::Whitespace push :when end rule /(else)(\s*)(%\})/ do groups Keyword::Reserved, Text::Whitespace, Punctuation pop! end # other builtin blocks rule /(capture)(\s+)([^\s%]+)(\s*)(%\})/ do groups Name::Tag, Text::Whitespace, Name::Attribute, Text::Whitespace, Punctuation pop! end rule /(comment)(\s*)(%\})/ do groups Name::Tag, Text::Whitespace, Punctuation push :comment end rule /(raw)(\s*)(%\})/ do groups Name::Tag, Text::Whitespace, Punctuation push :raw end rule /assign/, Name::Tag, :assign rule /include/, Name::Tag, :include # end of block rule /(end(case|unless|if))(\s*)(%\})/ do groups Keyword::Reserved, nil, Text::Whitespace, Punctuation pop! end rule /(end([^\s%]+))(\s*)(%\})/ do groups Name::Tag, nil, Text::Whitespace, Punctuation pop! end # builtin tags rule /(cycle)(\s+)(([^\s:]*)(:))?(\s*)/ do |m| token Name::Tag, m[1] token Text::Whitespace, m[2] if m[4] =~ /'[^']*'/ token Str::Single, m[4] elsif m[4] =~ /"[^"]*"/ token Str::Double, m[4] else token Name::Attribute, m[4] end token Punctuation, m[5] token Text::Whitespace, m[6] push :variable_tag_markup end # other tags or blocks rule /([^\s%]+)(\s*)/ do groups Name::Tag, Text::Whitespace push :tag_markup end end state :output do mixin :whitespace mixin :generic rule /\}\}/, Punctuation, :pop! rule /\|/, Punctuation, :filters end state :filters do mixin :whitespace rule(/\}\}/) { token Punctuation; reset_stack } rule /([^\s\|:]+)(:?)(\s*)/ do groups Name::Function, Punctuation, Text::Whitespace push :filter_markup end end state :filter_markup do rule /\|/, Punctuation, :pop! mixin :end_of_tag mixin :end_of_block mixin :default_param_markup end state :condition do mixin :end_of_block mixin :whitespace rule /([=!><]=?)/, Operator rule /\b((!)|(not\b))/ do groups nil, Operator, Operator::Word end rule /(contains)/, Operator::Word mixin :generic mixin :whitespace end state :when do mixin :end_of_block mixin :whitespace mixin :generic end state :operator do rule /(\s*)((=|!|>|<)=?)(\s*)/ do groups Text::Whitespace, Operator, nil, Text::Whitespace pop! end rule /(\s*)(\bcontains\b)(\s*)/ do groups Text::Whitespace, Operator::Word, Text::Whitespace pop! end end state :end_of_tag do rule(/\}\}/) { token Punctuation; reset_stack } end state :end_of_block do rule(/%\}/) { token Punctuation; reset_stack } end # states for unknown markup state :param_markup do mixin :whitespace mixin :string rule /([^\s=:]+)(\s*)(=|:)/ do groups Name::Attribute, Text::Whitespace, Operator end rule /(\{\{)(\s*)([^\s\}])(\s*)(\}\})/ do groups Punctuation, Text::Whitespace, nil, Text::Whitespace, Punctuation end mixin :number mixin :keyword rule /,/, Punctuation end state :default_param_markup do mixin :param_markup rule /./, Text end state :variable_param_markup do mixin :param_markup mixin :variable rule /./, Text end state :tag_markup do mixin :end_of_block mixin :default_param_markup end state :variable_tag_markup do mixin :end_of_block mixin :variable_param_markup end # states for different values types state :keyword do rule /\b(false|true)\b/, Keyword::Constant end state :variable do rule /\.(?=\w)/, Punctuation rule /[a-zA-Z_]\w*\??/, Name::Variable end state :string do rule /'[^']*'/, Str::Single rule /"[^"]*"/, Str::Double end state :number do rule /\d+\.\d+/, Num::Float rule /\d+/, Num::Integer end state :array_index do rule /\[/, Punctuation rule /\]/, Punctuation end state :generic do mixin :array_index mixin :keyword mixin :string mixin :variable mixin :number end state :whitespace do rule /[ \t]+/, Text::Whitespace end state :comment do rule /(\{%)(\s*)(endcomment)(\s*)(%\})/ do groups Punctuation, Text::Whitespace, Name::Tag, Text::Whitespace, Punctuation reset_stack end rule /./, Comment end state :raw do rule /[^\{]+/, Text rule /(\{%)(\s*)(endraw)(\s*)(%\})/ do groups Punctuation, Text::Whitespace, Name::Tag, Text::Whitespace, Punctuation reset_stack end rule /\{/, Text end state :assign do mixin :whitespace mixin :end_of_block rule /(\s*)(=)(\s*)/ do groups Text::Whitespace, Operator, Text::Whitespace end rule /\|/, Punctuation, :filters mixin :generic end state :include do mixin :whitespace rule /([^\.]+)(\.)(html|liquid)/ do groups Name::Attribute, Punctuation, Name::Attribute end mixin :variable_tag_markup end end end end rouge-2.2.1/lib/rouge/lexers/gradle.rb0000644000175000017500000000217113150713277017454 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers load_lexer 'groovy.rb' class Gradle < Groovy title "Gradle" desc "A powerful build system for the JVM" tag 'gradle' filenames '*.gradle' mimetypes 'text/x-gradle' def self.keywords @keywords ||= super + Set.new(%w( allprojects artifacts buildscript configuration dependencies repositories sourceSets subprojects publishing )) end def self.types @types ||= super + Set.new(%w( Project Task Gradle Settings Script JavaToolChain SourceSet SourceSetOutput IncrementalTaskInputs Configuration ResolutionStrategy ArtifactResolutionQuery ComponentSelection ComponentSelectionRules ConventionProperty ExtensionAware ExtraPropertiesExtension PublishingExtension IvyPublication IvyArtifact IvyArtifactSet IvyModuleDescriptorSpec MavenPublication MavenArtifact MavenArtifactSet MavenPom PluginDependenciesSpec PluginDependencySpec ResourceHandler TextResourceFactory )) end end end end rouge-2.2.1/lib/rouge/lexers/irb.rb0000644000175000017500000000236113150713277016773 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers load_lexer 'console.rb' class IRBLexer < ConsoleLexer tag 'irb' aliases 'pry' desc 'Shell sessions in IRB or Pry' # unlike the superclass, we do not accept any options @option_docs = {} def output_lexer @output_lexer ||= IRBOutputLexer.new(@options) end def lang_lexer @lang_lexer ||= Ruby.new(@options) end def prompt_regex /^.*?(irb|pry).*?[>"*]/ end def allow_comments? true end end load_lexer 'ruby.rb' class IRBOutputLexer < Ruby tag 'irb_output' start do push :stdout end state :has_irb_output do rule %r(=>), Punctuation, :pop! rule /.+?(\n|$)/, Generic::Output end state :irb_error do rule /.+?(\n|$)/, Generic::Error mixin :has_irb_output end state :stdout do rule /\w+?(Error|Exception):.+?(\n|$)/, Generic::Error, :irb_error mixin :has_irb_output end prepend :root do rule /#/, Keyword::Type, :pop! mixin :root end end end end rouge-2.2.1/lib/rouge/lexers/tex.rb0000644000175000017500000000334413150713277017021 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class TeX < RegexLexer title "TeX" desc "The TeX typesetting system" tag 'tex' aliases 'TeX', 'LaTeX', 'latex' filenames '*.tex', '*.aux', '*.toc', '*.sty', '*.cls' mimetypes 'text/x-tex', 'text/x-latex' def self.analyze_text(text) return 1 if text =~ /\A\s*\\(documentclass|input|documentstyle|relax|ProvidesPackage|ProvidesClass)/ end command = /\\([a-z]+|\s+|.)/i state :general do rule /%.*$/, Comment rule /[{}&_^]/, Punctuation end state :root do rule /\\\[/, Punctuation, :displaymath rule /\\\(/, Punctuation, :inlinemath rule /\$\$/, Punctuation, :displaymath rule /\$/, Punctuation, :inlinemath rule /\\(begin|end)\{.*?\}/, Name::Tag rule /(\\verb)\b(\S)(.*?)(\2)/ do |m| groups Name::Builtin, Keyword::Pseudo, Str::Other, Keyword::Pseudo end rule command, Keyword, :command mixin :general rule /[^\\$%&_^{}]+/, Text end state :math do rule command, Name::Variable mixin :general rule /[0-9]+/, Num rule /[-=!+*\/()\[\]]/, Operator rule /[^=!+*\/()\[\]\\$%&_^{}0-9-]+/, Name::Builtin end state :inlinemath do rule /\\\)/, Punctuation, :pop! rule /\$/, Punctuation, :pop! mixin :math end state :displaymath do rule /\\\]/, Punctuation, :pop! rule /\$\$/, Punctuation, :pop! rule /\$/, Name::Builtin mixin :math end state :command do rule /\[.*?\]/, Name::Attribute rule /\*/, Keyword rule(//) { pop! } end end end end rouge-2.2.1/lib/rouge/lexers/typescript.rb0000644000175000017500000000061513150713277020425 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # 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' end end end rouge-2.2.1/lib/rouge/lexers/json_doc.rb0000644000175000017500000000073413150713277020017 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers load_lexer 'json.rb' class JSONDOC < JSON desc "JavaScript Object Notation with extenstions for documentation" tag 'json-doc' prepend :root do rule /([$\w]+)(\s*)(:)/ do groups Name::Attribute, Text, Punctuation end rule %r(/[*].*?[*]/), Comment rule %r(//.*?$), Comment::Single rule /(\.\.\.)/, Comment::Single end end end end rouge-2.2.1/lib/rouge/lexers/erlang.rb0000644000175000017500000001031713150713277017467 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Erlang < RegexLexer title "Erlang" desc "The Erlang programming language (erlang.org)" tag 'erlang' aliases 'erl' filenames '*.erl', '*.hrl' mimetypes 'text/x-erlang', 'application/x-erlang' def self.analyze_text(text) return 0.3 if text =~ /^-module[(]\w+[)][.]/ end keywords = %w( after begin case catch cond end fun if let of query receive try when ) builtins = %w( abs append_element apply atom_to_list binary_to_list bitstring_to_list binary_to_term bit_size bump_reductions byte_size cancel_timer check_process_code delete_module demonitor disconnect_node display element erase exit float float_to_list fun_info fun_to_list function_exported garbage_collect get get_keys group_leader hash hd integer_to_list iolist_to_binary iolist_size is_atom is_binary is_bitstring is_boolean is_builtin is_float is_function is_integer is_list is_number is_pid is_port is_process_alive is_record is_reference is_tuple length link list_to_atom list_to_binary list_to_bitstring list_to_existing_atom list_to_float list_to_integer list_to_pid list_to_tuple load_module localtime_to_universaltime make_tuple md5 md5_final md5_update memory module_loaded monitor monitor_node node nodes open_port phash phash2 pid_to_list port_close port_command port_connect port_control port_call port_info port_to_list process_display process_flag process_info purge_module put read_timer ref_to_list register resume_process round send send_after send_nosuspend set_cookie setelement size spawn spawn_link spawn_monitor spawn_opt split_binary start_timer statistics suspend_process system_flag system_info system_monitor system_profile term_to_binary tl trace trace_delivered trace_info trace_pattern trunc tuple_size tuple_to_list universaltime_to_localtime unlink unregister whereis ) operators = %r{(\+\+?|--?|\*|/|<|>|/=|=:=|=/=|=<|>=|==?|<-|!|\?)} word_operators = %w( and andalso band bnot bor bsl bsr bxor div not or orelse rem xor ) atom_re = %r{(?:[a-z][a-zA-Z0-9_]*|'[^\n']*[^\\]')} variable_re = %r{(?:[A-Z_][a-zA-Z0-9_]*)} escape_re = %r{(?:\\(?:[bdefnrstv\'"\\/]|[0-7][0-7]?[0-7]?|\^[a-zA-Z]))} macro_re = %r{(?:#{variable_re}|#{atom_re})} base_re = %r{(?:[2-9]|[12][0-9]|3[0-6])} state :root do rule(/\s+/, Text) rule(/%.*\n/, Comment) rule(%r{(#{keywords.join('|')})\b}, Keyword) rule(%r{(#{builtins.join('|')})\b}, Name::Builtin) rule(%r{(#{word_operators.join('|')})\b}, Operator::Word) rule(/^-/, Punctuation, :directive) rule(operators, Operator) rule(/"/, Str, :string) rule(/<>/, Name::Label) rule %r{(#{atom_re})(:)} do groups Name::Namespace, Punctuation end rule %r{(?:^|(?<=:))(#{atom_re})(\s*)(\()} do groups Name::Function, Text, Punctuation end rule(%r{[+-]?#{base_re}#[0-9a-zA-Z]+}, Num::Integer) rule(/[+-]?\d+/, Num::Integer) rule(/[+-]?\d+.\d+/, Num::Float) rule(%r{[\]\[:_@\".{}()|;,]}, Punctuation) rule(variable_re, Name::Variable) rule(atom_re, Name) rule(%r{\?#{macro_re}}, Name::Constant) rule(%r{\$(?:#{escape_re}|\\[ %]|[^\\])}, Str::Char) rule(%r{##{atom_re}(:?\.#{atom_re})?}, Name::Label) end state :string do rule(escape_re, Str::Escape) rule(/"/, Str, :pop!) rule(%r{~[0-9.*]*[~#+bBcdefginpPswWxX]}, Str::Interpol) rule(%r{[^"\\~]+}, Str) rule(/~/, Str) end state :directive do rule %r{(define)(\s*)(\()(#{macro_re})} do groups Name::Entity, Text, Punctuation, Name::Constant pop! end rule %r{(record)(\s*)(\()(#{macro_re})} do groups Name::Entity, Text, Punctuation, Name::Label pop! end rule(atom_re, Name::Entity, :pop!) end end end end rouge-2.2.1/lib/rouge/lexers/dart.rb0000644000175000017500000000562613150713277017160 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Dart < RegexLexer title "Dart" desc "The Dart programming language (dartlang.com)" tag 'dart' filenames '*.dart' mimetypes 'text/x-dart' keywords = %w( as assert break case catch continue default do else finally for if in is new rethrow return super switch this throw try while with ) declarations = %w( abstract dynamic const external extends factory final get implements native operator set static typedef var ) types = %w(bool double Dynamic enum int num Object Set String void) imports = %w(import export library part\s*of part source) id = /[a-zA-Z_]\w*/ state :root do rule %r(^ (\s*(?:[a-zA-Z_][a-zA-Z\d_.\[\]]*\s+)+?) # return arguments ([a-zA-Z_][\w]*) # method name (\s*)(\() # signature start )mx do |m| # TODO: do this better, this shouldn't need a delegation delegate Dart, m[1] token Name::Function, m[2] token Text, m[3] token Punctuation, m[4] end rule /\s+/, Text rule %r(//.*?$), Comment::Single rule %r(/\*.*?\*/)m, Comment::Multiline rule /"/, Str, :dqs rule /'/, Str, :sqs rule /r"[^"]*"/, Str::Other rule /r'[^']*'/, Str::Other rule /##{id}*/i, Str::Symbol rule /@#{id}/, Name::Decorator rule /(?:#{keywords.join('|')})\b/, Keyword rule /(?:#{declarations.join('|')})\b/, Keyword::Declaration rule /(?:#{types.join('|')})\b/, Keyword::Type rule /(?:true|false|null)\b/, Keyword::Constant rule /(?:class|interface)\b/, Keyword::Declaration, :class rule /(?:#{imports.join('|')})\b/, Keyword::Namespace, :import rule /(\.)(#{id})/ do groups Operator, Name::Attribute end rule /#{id}:/, Name::Label rule /\$?#{id}/, Name rule /[~^*!%&\[\](){}<>\|+=:;,.\/?-]/, Operator rule /\d*\.\d+([eE]\-?\d+)?/, Num::Float rule /0x[\da-fA-F]+/, Num::Hex rule /\d+L?/, Num::Integer rule /\n/, Text end state :class do rule /\s+/m, Text rule id, Name::Class, :pop! end state :dqs do rule /"/, Str, :pop! rule /[^\\\$"]+/, Str mixin :string end state :sqs do rule /'/, Str, :pop! rule /[^\\\$']+/, Str mixin :string end state :import do rule /;/, Operator, :pop! rule /(?:show|hide)\b/, Keyword::Declaration mixin :root end state :string do mixin :interpolation rule /\\[nrt\"\'\\]/, Str::Escape end state :interpolation do rule /\$#{id}/, Str::Interpol rule /\$\{[^\}]+\}/, Str::Interpol end end end end rouge-2.2.1/lib/rouge/lexers/dot.rb0000644000175000017500000000310013150713277016775 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Dot < RegexLexer title "DOT" desc "graph description language" tag 'dot' filenames '*.dot' mimetypes 'text/vnd.graphviz' start do @html = HTML.new(options) end state :comments_and_whitespace do rule /\s+/, Text rule %r(#.*?\n), Comment::Single rule %r(//.*?\n), Comment::Single rule %r(/(\\\n)?[*].*?[*](\\\n)?/)m, Comment::Multiline end state :html do rule /[^<>]+/ do delegate @html end rule /<.+?>/m do delegate @html end rule />/, Punctuation, :pop! end state :ID do rule /([a-zA-Z][a-zA-Z_0-9]*)(\s*)(=)/ do |m| token Name, m[1] token Text, m[2] token Punctuation, m[3] end rule /[a-zA-Z][a-zA-Z_0-9]*/, Name::Variable rule /([0-9]+)?\.[0-9]+/, Num::Float rule /[0-9]+/, Num::Integer rule /"(\\"|[^"])*"/, Str::Double rule /]/, Operator rule /\[/, Operator, :a_list mixin :ID end end end end rouge-2.2.1/lib/rouge/lexers/scala.rb0000644000175000017500000001004113150713277017274 0ustar uwabamiuwabami# -*- coding: utf-8 # module Rouge module Lexers class Scala < RegexLexer title "Scala" desc "The Scala programming language (scala-lang.org)" tag 'scala' aliases 'scala' filenames '*.scala', '*.sbt' mimetypes 'text/x-scala', 'application/x-scala' # As documented in the ENBF section of the scala specification # http://www.scala-lang.org/docu/files/ScalaReference.pdf whitespace = /\p{Space}/ letter = /[\p{L}$_]/ upper = /[\p{Lu}$_]/ digits = /[0-9]/ parens = /[(){}\[\]]/ delims = %r([‘’".;,]) # negative lookahead to filter out other classes op = %r( (?!#{whitespace}|#{letter}|#{digits}|#{parens}|#{delims}) [\u0020-\u007F\p{Sm}\p{So}] )x idrest = %r(#{letter}(?:#{letter}|#{digits})*(?:(?<=_)#{op}+)?)x keywords = %w( abstract case catch def do else extends final finally for forSome if implicit lazy match new override private protected requires return sealed super this throw try val var while with yield ) state :root do rule /(class|trait|object)(\s+)/ do groups Keyword, Text push :class end rule /'#{idrest}[^']/, Str::Symbol rule /[^\S\n]+/, Text rule %r(//.*?\n), Comment::Single rule %r(/\*), Comment::Multiline, :comment rule /@#{idrest}/, Name::Decorator rule %r( (#{keywords.join("|")})\b| (<[%:-]|=>|>:|[#=@_\u21D2\u2190])(\b|(?=\s)|$) )x, Keyword rule /:(?!#{op})/, Keyword, :type rule /#{upper}#{idrest}\b/, Name::Class rule /(true|false|null)\b/, Keyword::Constant rule /(import|package)(\s+)/ do groups Keyword, Text push :import end rule /(type)(\s+)/ do groups Keyword, Text push :type end rule /""".*?"""(?!")/m, Str rule /"(\\\\|\\"|[^"])*"/, Str rule /'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'/, Str::Char rule idrest, Name rule /`[^`]+`/, Name rule /\[/, Operator, :typeparam rule /[\(\)\{\};,.#]/, Operator rule /#{op}+/, Operator rule /([0-9][0-9]*\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?/, Num::Float rule /([0-9][0-9]*[fFdD])/, Num::Float rule /0x[0-9a-fA-F]+/, Num::Hex rule /[0-9]+L?/, Num::Integer rule /\n/, Text end state :class do rule /(#{idrest}|#{op}+|`[^`]+`)(\s*)(\[)/ do groups Name::Class, Text, Operator push :typeparam end rule /\s+/, Text rule /{/, Operator, :pop! rule /\(/, Operator, :pop! rule %r(//.*?\n), Comment::Single, :pop! rule %r(#{idrest}|#{op}+|`[^`]+`), Name::Class, :pop! end state :type do rule /\s+/, Text rule /<[%:]|>:|[#_\u21D2]|forSome|type/, Keyword rule /([,\);}]|=>|=)(\s*)/ do groups Operator, Text pop! end rule /[\(\{]/, Operator, :type typechunk = /(?:#{idrest}|#{op}+\`[^`]+`)/ rule /(#{typechunk}(?:\.#{typechunk})*)(\s*)(\[)/ do groups Keyword::Type, Text, Operator pop! push :typeparam end rule /(#{typechunk}(?:\.#{typechunk})*)(\s*)$/ do groups Keyword::Type, Text pop! end rule %r(//.*?\n), Comment::Single, :pop! rule /\.|#{idrest}|#{op}+|`[^`]+`/, Keyword::Type end state :typeparam do rule /[\s,]+/, Text rule /<[%:]|=>|>:|[#_\u21D2]|forSome|type/, Keyword rule /([\]\)\}])/, Operator, :pop! rule /[\(\[\{]/, Operator, :typeparam rule /\.|#{idrest}|#{op}+|`[^`]+`/, Keyword::Type end state :comment do rule %r([^/\*]+), Comment::Multiline rule %r(/\*), Comment::Multiline, :comment rule %r(\*/), Comment::Multiline, :pop! rule %r([*/]), Comment::Multiline end state :import do rule %r((#{idrest}|\.)+), Name::Namespace, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/perl.rb0000644000175000017500000001632613150713277017167 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Perl < RegexLexer title "Perl" desc "The Perl scripting language (perl.org)" tag 'perl' aliases 'pl' filenames '*.pl', '*.pm' mimetypes 'text/x-perl', 'application/x-perl' def self.analyze_text(text) return 1 if text.shebang? 'perl' return 0.4 if text.include? 'my $' end keywords = %w( case continue do else elsif for foreach if last my next our redo reset then unless until while use print new BEGIN CHECK INIT END return ) builtins = %w( abs accept alarm atan2 bind binmode bless caller chdir chmod chomp chop chown chr chroot close closedir connect continue cos crypt dbmclose dbmopen defined delete die dump each endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl fileno flock fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt glob gmtime goto grep hex import index int ioctl join keys kill last lc lcfirst length link listen local localtime log lstat map mkdir msgctl msgget msgrcv msgsnd my next no oct open opendir ord our pack package pipe pop pos printf prototype push quotemeta rand read readdir readline readlink readpipe recv redo ref rename require reverse rewinddir rindex rmdir scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat study substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unlink unpack unshift untie utime values vec wait waitpid wantarray warn write ) re_tok = Str::Regex state :balanced_regex do rule %r(/(\\[\\/]|[^/])*/[egimosx]*)m, re_tok, :pop! rule %r(!(\\[\\!]|[^!])*![egimosx]*)m, re_tok, :pop! rule %r(\\(\\\\|[^\\])*\\[egimosx]*)m, re_tok, :pop! rule %r({(\\[\\}]|[^}])*}[egimosx]*), re_tok, :pop! rule %r(<(\\[\\>]|[^>])*>[egimosx]*), re_tok, :pop! rule %r(\[(\\[\\\]]|[^\]])*\][egimosx]*), re_tok, :pop! rule %r[\((\\[\\\)]|[^\)])*\)[egimosx]*], re_tok, :pop! rule %r(@(\\[\\@]|[^@])*@[egimosx]*), re_tok, :pop! rule %r(%(\\[\\%]|[^%])*%[egimosx]*), re_tok, :pop! rule %r(\$(\\[\\\$]|[^\$])*\$[egimosx]*), re_tok, :pop! end state :root do rule /#.*?$/, Comment::Single rule /^=[a-zA-Z0-9]+\s+.*?\n=cut/m, Comment::Multiline rule /(?:#{keywords.join('|')})\b/, Keyword rule /(format)(\s+)([a-zA-Z0-9_]+)(\s*)(=)(\s*\n)/ do groups Keyword, Text, Name, Text, Punctuation, Text push :format end rule /(?:eq|lt|gt|le|ge|ne|not|and|or|cmp)\b/, Operator::Word # common delimiters rule %r(s/(\\\\|\\/|[^/])*/(\\\\|\\/|[^/])*/[egimosx]*), re_tok rule %r(s!(\\\\|\\!|[^!])*!(\\\\|\\!|[^!])*![egimosx]*), re_tok rule %r(s\\(\\\\|[^\\])*\\(\\\\|[^\\])*\\[egimosx]*), re_tok rule %r(s@(\\\\|\\@|[^@])*@(\\\\|\\@|[^@])*@[egimosx]*), re_tok rule %r(s%(\\\\|\\%|[^%])*%(\\\\|\\%|[^%])*%[egimosx]*), re_tok # balanced delimiters rule %r(s{(\\\\|\\}|[^}])*}\s*), re_tok, :balanced_regex rule %r(s<(\\\\|\\>|[^>])*>\s*), re_tok, :balanced_regex rule %r(s\[(\\\\|\\\]|[^\]])*\]\s*), re_tok, :balanced_regex rule %r[s\((\\\\|\\\)|[^\)])*\)\s*], re_tok, :balanced_regex rule %r(m?/(\\\\|\\/|[^/\n])*/[gcimosx]*), re_tok rule %r(m(?=[/!\\{<\[\(@%\$])), re_tok, :balanced_regex rule %r(((?<==~)|(?<=\())\s*/(\\\\|\\/|[^/])*/[gcimosx]*), re_tok, :balanced_regex rule /\s+/, Text rule /(?:#{builtins.join('|')})\b/, Name::Builtin rule /((__(DATA|DIE|WARN)__)|(STD(IN|OUT|ERR)))\b/, Name::Builtin::Pseudo rule /<<([\'"]?)([a-zA-Z_][a-zA-Z0-9_]*)\1;?\n.*?\n\2\n/m, Str rule /__END__\b/, Comment::Preproc, :end_part rule /\$\^[ADEFHILMOPSTWX]/, Name::Variable::Global rule /\$[\\"'\[\]&`+*.,;=%~?@$!<>(^\|\/-](?!\w)/, Name::Variable::Global rule /[$@%#]+/, Name::Variable, :varname rule /0_?[0-7]+(_[0-7]+)*/, Num::Oct rule /0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*/, Num::Hex rule /0b[01]+(_[01]+)*/, Num::Bin rule /(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?/i, Num::Float rule /\d+(_\d*)*e[+-]?\d+(_\d*)*/i, Num::Float rule /\d+(_\d+)*/, Num::Integer rule /'(\\\\|\\'|[^'])*'/, Str rule /"(\\\\|\\"|[^"])*"/, Str rule /`(\\\\|\\`|[^`])*`/, Str::Backtick rule /<([^\s>]+)>/, re_tok rule /(q|qq|qw|qr|qx)\{/, Str::Other, :cb_string rule /(q|qq|qw|qr|qx)\(/, Str::Other, :rb_string rule /(q|qq|qw|qr|qx)\[/, Str::Other, :sb_string rule /(q|qq|qw|qr|qx)>|>=|<=|<=>|={3}|!=|=~|!~|&&?|\|\||\.{1,3}/, Operator rule /[-+\/*%=<>&^\|!\\~]=?/, Operator rule /[()\[\]:;,<>\/?{}]/, Punctuation rule(/(?=\w)/) { push :name } end state :format do rule /\.\n/, Str::Interpol, :pop! rule /.*?\n/, Str::Interpol end state :name_common do rule /\w+::/, Name::Namespace rule /[\w:]+/, Name::Variable, :pop! end state :varname do rule /\s+/, Text rule /\{/, Punctuation, :pop! # hash syntax rule /\)|,/, Punctuation, :pop! # arg specifier mixin :name_common end state :name do mixin :name_common rule /[A-Z_]+(?=[^a-zA-Z0-9_])/, Name::Constant, :pop! rule(/(?=\W)/) { pop! } end state :modulename do rule /[a-z_]\w*/i, Name::Namespace, :pop! end state :funcname do rule /[a-zA-Z_]\w*[!?]?/, Name::Function rule /\s+/, Text # argument declaration rule /(\([$@%]*\))(\s*)/ do groups Punctuation, Text end rule /.*?{/, Punctuation, :pop! rule /;/, Punctuation, :pop! end [[:cb, '\{', '\}'], [:rb, '\(', '\)'], [:sb, '\[', '\]'], [:lt, '<', '>']].each do |name, open, close| tok = Str::Other state :"#{name}_string" do rule /\\[#{open}#{close}\\]/, tok rule /\\/, tok rule(/#{open}/) { token tok; push } rule /#{close}/, tok, :pop! rule /[^#{open}#{close}\\]+/, tok end end state :end_part do # eat the rest of the stream rule /.+/m, Comment::Preproc, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/vue.rb0000644000175000017500000000516713150713277017025 0ustar uwabamiuwabamimodule Rouge module Lexers load_lexer 'html.rb' class Vue < HTML desc 'Vue.js single-file components' tag 'vue' aliases 'vuejs' filenames '*.vue' mimetypes 'text/x-vue', 'application/x-vue' def initialize(*) super @js = Javascript.new(options) end def self.analyze_text(text) return 0 end def lookup_lang(lang) case lang when 'html' then HTML when 'css' then CSS when 'javascript' then Javascript when 'sass' then Sass when 'scss' then Scss when 'coffee' then CoffeeScript # TODO: add more when the lexers are done else PlainText end end start { @js.reset! } prepend :root do rule /(<)(\s*)(template)/ do groups Name::Tag, Text, Keyword @lang = HTML push :template push :lang_tag end rule /(<)(\s*)(style)/ do groups Name::Tag, Text, Keyword @lang = CSS push :style push :lang_tag end rule /(<)(\s*)(script)/ do groups Name::Tag, Text, Keyword @lang = Javascript push :script push :lang_tag end end state :style do rule /(<\s*\/\s*)(style)(\s*>)/ do groups Name::Tag, Keyword, Name::Tag pop! end mixin :style_content mixin :embed end state :script do rule /(<\s*\/\s*)(script)(\s*>)/ do groups Name::Tag, Keyword, Name::Tag pop! end mixin :script_content mixin :embed end state :lang_tag do rule /(lang\s*=)(\s*)("(?:\\.|[^\\])*?"|'(\\.|[^\\])*?'|[^\s>]+)/ do |m| groups Name::Attribute, Text, Str @lang = lookup_lang(m[2]) end mixin :tag end state :template do rule %r((<\s*/\s*)(template)(\s*>)) do groups Name::Tag, Keyword, Name::Tag pop! end rule /{{/ do token Str::Interpol push :template_interpol @js.reset! end mixin :embed end state :template_interpol do rule /}}/, Str::Interpol, :pop! rule /}/, Error mixin :template_interpol_inner end state :template_interpol_inner do rule(/{/) { delegate @js; push } rule(/}/) { delegate @js; pop! } rule(/[^{}]+/) { delegate @js } end state :embed do rule(/[^{<]+/) { delegate @lang } rule(/[<{][^<{]*/) { delegate @lang } end end end end rouge-2.2.1/lib/rouge/lexers/mxml.rb0000644000175000017500000000305113150713277017171 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class MXML < RegexLexer title "MXML" desc "MXML" tag 'mxml' filenames '*.mxml' mimetypes 'application/xv+xml' state :root do rule /[^<&]+/, Text rule /&\S*?;/, Name::Entity rule //, Comment::Preproc rule /]*>/, Comment::Preproc rule %r(<\s*[\w:.-]+)m, Name::Tag, :tag # opening tags rule %r(<\s*/\s*[\w:.-]+\s*>)m, Name::Tag # closing tags end state :comment do rule /[^-]+/m, Comment rule /-->/, Comment, :pop! rule /-/, Comment end state :tag do rule /\s+/m, Text rule /[\w.:-]+\s*=/m, Name::Attribute, :attribute rule %r(/?\s*>), Name::Tag, :root end state :attribute do rule /\s+/m, Text rule /(")({|@{)/m do groups Str, Punctuation push :actionscript_attribute end rule /".*?"|'.*?'|[^\s>]+/, Str, :tag end state :actionscript_content do rule /\]\]\>/m, Comment::Preproc, :pop! rule /.*?(?=\]\]\>)/m do delegate Actionscript end end state :actionscript_attribute do rule /(})(")/m do groups Punctuation, Str push :tag end rule /.*?(?=}")/m do delegate Actionscript end end end end end rouge-2.2.1/lib/rouge/lexers/llvm.rb0000644000175000017500000000544713150713277017201 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class LLVM < RegexLexer title "LLVM" desc 'The LLVM Compiler Infrastructure (http://llvm.org/)' tag 'llvm' filenames '*.ll' mimetypes 'text/x-llvm' def self.analyze_text(text) return 0.1 if text =~ /\A%\w+\s=\s/ end string = /"[^"]*?"/ identifier = /([-a-zA-Z$._][-a-zA-Z$._0-9]*|#{string})/ state :basic do rule /;.*?$/, Comment::Single rule /\s+/, Text rule /#{identifier}\s*:/, Name::Label rule /@(#{identifier}|\d+)/, Name::Variable::Global rule /(%|!)#{identifier}/, Name::Variable rule /(%|!)\d+/, Name::Variable rule /c?#{string}/, Str rule /0[xX][a-fA-F0-9]+/, Num rule /-?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?/, Num rule /[=<>{}\[\]()*.,!]|x/, Punctuation end builtin_types = %w( void float double half x86_fp80 x86mmx fp128 ppc_fp128 label metadata ) state :types do rule /i[1-9]\d*/, Keyword::Type rule /#{builtin_types.join('|')}/, Keyword::Type end builtin_keywords = %w( begin end true false declare define global constant personality private landingpad linker_private internal available_externally linkonce_odr linkonce weak weak_odr appending dllimport dllexport common default hidden protected extern_weak external thread_local zeroinitializer undef null to tail target triple datalayout volatile nuw nsw nnan ninf nsz arcp fast exact inbounds align addrspace section alias module asm sideeffect gc dbg ccc fastcc coldcc x86_stdcallcc x86_fastcallcc arm_apcscc arm_aapcscc arm_aapcs_vfpcc ptx_device ptx_kernel cc c signext zeroext inreg sret nounwind noreturn noalias nocapture byval nest readnone readonly inlinehint noinline alwaysinline optsize ssp sspreq noredzone noimplicitfloat naked type opaque eq ne slt sgt sle sge ult ugt ule uge oeq one olt ogt ole oge ord uno unnamed_addr ueq une uwtable x ) builtin_instructions = %w( add fadd sub fsub mul fmul udiv sdiv fdiv urem srem frem shl lshr ashr and or xor icmp fcmp phi call catch trunc zext sext fptrunc fpext uitofp sitofp fptoui fptosi inttoptr ptrtoint bitcast select va_arg ret br switch invoke unwind unreachable malloc alloca free load store getelementptr extractelement insertelement shufflevector getresult extractvalue insertvalue cleanup resume ) state :keywords do rule /#{builtin_instructions.join('|')}/, Keyword rule /#{builtin_keywords.join('|')}/, Keyword end state :root do mixin :basic mixin :keywords mixin :types end end end end rouge-2.2.1/lib/rouge/lexers/matlab/0000755000175000017500000000000013150713277017130 5ustar uwabamiuwabamirouge-2.2.1/lib/rouge/lexers/matlab/builtins.rb0000644000175000017500000003467413150713277021324 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # # automatically generated by `rake builtins:matlab` module Rouge module Lexers class Matlab def self.builtins @builtins ||= Set.new %w(ans clc diary format home iskeyword more zeros ones rand true false eye diag blkdiag cat horzcat vertcat repelem repmat linspace logspace freqspace meshgrid ndgrid length size ndims numel isscalar isvector ismatrix isrow iscolumn isempty sort sortrows issorted issortedrows flip fliplr flipud rot90 transpose ctranspose permute ipermute circshift shiftdim reshape squeeze colon end ind2sub sub2ind plus uplus minus uminus times rdivide ldivide power mtimes mrdivide mldivide mpower cumprod cumsum diff movsum prod sum ceil fix floor idivide mod rem round bsxfun eq ge gt le lt ne isequal isequaln logicaloperatorsshortcircuit and not or xor all any false find islogical logical true intersect ismember ismembertol issorted setdiff setxor union unique uniquetol join innerjoin outerjoin bitand bitcmp bitget bitor bitset bitshift bitxor swapbytes double single int8 int16 int32 int64 uint8 uint16 uint32 uint64 cast typecast isinteger isfloat isnumeric isreal isfinite isinf isnan eps flintmax inf intmax intmin nan realmax realmin string strings join char cellstr blanks newline compose sprintf strcat ischar iscellstr isstring strlength isstrprop isletter isspace contains count endswith startswith strfind sscanf replace replacebetween strrep join split splitlines strjoin strsplit strtok erase erasebetween extractafter extractbefore extractbetween insertafter insertbefore pad strip lower upper reverse deblank strtrim strjust strcmp strcmpi strncmp strncmpi regexp regexpi regexprep regexptranslate datetime timezones years days hours minutes seconds milliseconds duration calyears calquarters calmonths calweeks caldays calendarduration exceltime juliandate posixtime yyyymmdd year quarter month week day hour minute second ymd hms split time timeofday isdst isweekend tzoffset between caldiff dateshift isbetween isdatetime isduration iscalendarduration isnat nat datenum datevec datestr char cellstr string now clock date calendar eomday weekday addtodate etime categorical iscategorical discretize categories iscategory isordinal isprotected addcats mergecats removecats renamecats reordercats setcats summary countcats isundefined table array2table cell2table struct2table table2array table2cell table2struct readtable writetable detectimportoptions istable head tail height width summary intersect ismember setdiff setxor unique union join innerjoin outerjoin sortrows stack unstack vartype ismissing standardizemissing rmmissing fillmissing varfun rowfun findgroups splitapply timetable retime synchronize lag table2timetable array2timetable timetable2table istimetable isregular timerange withtol vartype rmmissing issorted sortrows unique struct fieldnames getfield isfield isstruct orderfields rmfield setfield arrayfun structfun table2struct struct2table cell2struct struct2cell cell cell2mat cell2struct cell2table celldisp cellfun cellplot cellstr iscell iscellstr mat2cell num2cell strjoin strsplit struct2cell table2cell feval func2str str2func localfunctions functions addevent delevent gettsafteratevent gettsafterevent gettsatevent gettsbeforeatevent gettsbeforeevent gettsbetweenevents gettscollection isemptytscollection lengthtscollection settscollection sizetscollection tscollection addsampletocollection addts delsamplefromcollection getabstimetscollection getsampleusingtimetscollection gettimeseriesnames horzcattscollection removets resampletscollection setabstimetscollection settimeseriesnames vertcattscollection isa iscalendarduration iscategorical iscell iscellstr ischar isdatetime isduration isfield isfloat isgraphics isinteger isjava islogical isnumeric isobject isreal isenum isstruct istable is class validateattributes whos char cellstr int2str mat2str num2str str2double str2num native2unicode unicode2native base2dec bin2dec dec2base dec2bin dec2hex hex2dec hex2num num2hex table2array table2cell table2struct array2table cell2table struct2table cell2mat cell2struct mat2cell num2cell struct2cell plus uplus minus uminus times rdivide ldivide power mtimes mrdivide mldivide mpower cumprod cumsum diff movsum prod sum ceil fix floor idivide mod rem round bsxfun sin sind asin asind sinh asinh cos cosd acos acosd cosh acosh tan tand atan atand atan2 atan2d tanh atanh csc cscd acsc acscd csch acsch sec secd asec asecd sech asech cot cotd acot acotd coth acoth hypot deg2rad rad2deg exp expm1 log log10 log1p log2 nextpow2 nthroot pow2 reallog realpow realsqrt sqrt abs angle complex conj cplxpair i imag isreal j real sign unwrap factor factorial gcd isprime lcm nchoosek perms primes rat rats poly polyeig polyfit residue roots polyval polyvalm conv deconv polyint polyder airy besselh besseli besselj besselk bessely beta betainc betaincinv betaln ellipj ellipke erf erfc erfcinv erfcx erfinv expint gamma gammainc gammaincinv gammaln legendre psi cart2pol cart2sph pol2cart sph2cart eps flintmax i j inf pi nan isfinite isinf isnan compan gallery hadamard hankel hilb invhilb magic pascal rosser toeplitz vander wilkinson mldivide mrdivide linsolve inv pinv lscov lsqnonneg sylvester eig eigs balance svd svds gsvd ordeig ordqz ordschur polyeig qz hess schur rsf2csf cdf2rdf lu ldl chol cholupdate qr qrdelete qrinsert qrupdate planerot transpose ctranspose mtimes mpower sqrtm expm logm funm kron cross dot bandwidth tril triu isbanded isdiag ishermitian issymmetric istril istriu norm normest cond condest rcond condeig det null orth rank rref trace subspace rand randn randi randperm rng interp1 interp2 interp3 interpn pchip spline ppval mkpp unmkpp padecoef interpft ndgrid meshgrid griddata griddatan fminbnd fminsearch lsqnonneg fzero optimget optimset ode45 ode23 ode113 ode15s ode23s ode23t ode23tb ode15i decic odeget odeset deval odextend bvp4c bvp5c bvpinit bvpxtend bvpget bvpset deval dde23 ddesd ddensd ddeget ddeset deval pdepe pdeval integral integral2 integral3 quadgk quad2d cumtrapz trapz polyint del2 diff gradient polyder fft fft2 fftn fftshift fftw ifft ifft2 ifftn ifftshift nextpow2 interpft conv conv2 convn deconv filter filter2 ss2tf padecoef spalloc spdiags speye sprand sprandn sprandsym sparse spconvert issparse nnz nonzeros nzmax spfun spones spparms spy find full amd colamd colperm dmperm randperm symamd symrcm pcg minres symmlq gmres bicg bicgstab bicgstabl cgs qmr tfqmr lsqr ichol ilu eigs svds normest condest sprank etree symbfact spaugment dmperm etreeplot treelayout treeplot gplot unmesh graph digraph tetramesh trimesh triplot trisurf delaunay delaunayn tetramesh trimesh triplot trisurf dsearchn tsearchn delaunay delaunayn boundary alphashape convhull convhulln patch voronoi voronoin polyarea inpolygon rectint plot plot3 loglog semilogx semilogy errorbar fplot fplot3 fimplicit linespec colorspec bar bar3 barh bar3h histogram histcounts histogram2 histcounts2 rose pareto area pie pie3 stem stairs stem3 scatter scatter3 spy plotmatrix heatmap polarplot polarscatter polarhistogram compass ezpolar rlim thetalim rticks thetaticks rticklabels thetaticklabels rtickformat thetatickformat rtickangle polaraxes contour contourf contourc contour3 contourslice clabel fcontour feather quiver compass quiver3 streamslice streamline surf surfc surface surfl surfnorm mesh meshc meshz hidden fsurf fmesh fimplicit3 waterfall ribbon contour3 peaks cylinder ellipsoid sphere pcolor surf2patch contourslice flow isocaps isocolors isonormals isosurface reducepatch reducevolume shrinkfaces slice smooth3 subvolume volumebounds coneplot curl divergence interpstreamspeed stream2 stream3 streamline streamparticles streamribbon streamslice streamtube fill fill3 patch surf2patch movie getframe frame2im im2frame animatedline comet comet3 drawnow refreshdata title xlabel ylabel zlabel clabel legend colorbar text texlabel gtext line rectangle annotation xlim ylim zlim axis box daspect pbaspect grid xticks yticks zticks xticklabels yticklabels zticklabels xtickformat ytickformat ztickformat xtickangle ytickangle ztickangle datetick ruler2num num2ruler hold subplot yyaxis cla axes figure colormap colorbar rgbplot colormapeditor brighten contrast caxis spinmap hsv2rgb rgb2hsv parula jet hsv hot cool spring summer autumn winter gray bone copper pink lines colorcube prism flag view makehgtform viewmtx cameratoolbar campan camzoom camdolly camlookat camorbit campos camproj camroll camtarget camup camva camlight light lightangle lighting shading diffuse material specular alim alpha alphamap imshow image imagesc imread imwrite imfinfo imformats frame2im im2frame im2java im2double ind2rgb rgb2gray rgb2ind imapprox dither cmpermute cmunique print saveas getframe savefig openfig orient hgexport printopt get set reset inspect gca gcf gcbf gcbo gco groot ancestor allchild findall findobj findfigs gobjects isgraphics ishandle copyobj delete gobjects isgraphics isempty isequal isa clf cla close uicontextmenu uimenu dragrect rbbox refresh shg hggroup hgtransform makehgtform eye hold ishold newplot clf cla drawnow opengl readtable detectimportoptions writetable textscan dlmread dlmwrite csvread csvwrite type readtable detectimportoptions writetable xlsfinfo xlsread xlswrite importdata im2java imfinfo imread imwrite nccreate ncdisp ncinfo ncread ncreadatt ncwrite ncwriteatt ncwriteschema h5create h5disp h5info h5read h5readatt h5write h5writeatt hdfinfo hdfread hdftool imread imwrite hdfan hdfhx hdfh hdfhd hdfhe hdfml hdfpt hdfv hdfvf hdfvh hdfvs hdfdf24 hdfdfr8 fitsdisp fitsinfo fitsread fitswrite multibandread multibandwrite cdfinfo cdfread cdfepoch todatenum audioinfo audioread audiowrite videoreader videowriter mmfileinfo lin2mu mu2lin audiodevinfo audioplayer audiorecorder sound soundsc beep xmlread xmlwrite xslt load save matfile disp who whos clear clearvars openvar fclose feof ferror fgetl fgets fileread fopen fprintf fread frewind fscanf fseek ftell fwrite tcpclient web webread webwrite websave weboptions sendmail jsondecode jsonencode readasync serial serialbreak seriallist stopasync instrcallback instrfind instrfindall record tabulartextdatastore imagedatastore spreadsheetdatastore filedatastore datastore tall datastore mapreducer gather head tail topkrows istall classunderlying isaunderlying write mapreduce datastore add addmulti hasnext getnext mapreducer gcmr matfile memmapfile ismissing rmmissing fillmissing missing standardizemissing isoutlier filloutliers smoothdata movmean movmedian detrend filter filter2 discretize histcounts histcounts2 findgroups splitapply rowfun varfun accumarray min max bounds mean median mode std var corrcoef cov cummax cummin movmad movmax movmean movmedian movmin movprod movstd movsum movvar pan zoom rotate rotate3d brush datacursormode ginput linkdata linkaxes linkprop refreshdata figurepalette plotbrowser plotedit plottools propertyeditor propedit showplottool if for parfor switch try while break continue end pause return edit input publish grabcode snapnow function nargin nargout varargin varargout narginchk nargoutchk validateattributes validatestring inputname isvarname namelengthmax persistent assignin global mlock munlock mislocked try error warning lastwarn assert oncleanup addpath rmpath path savepath userpath genpath pathsep pathtool restoredefaultpath rehash dir ls pwd fileattrib exist isdir type visdiff what which cd copyfile delete recycle mkdir movefile rmdir open winopen zip unzip gzip gunzip tar untar fileparts fullfile filemarker filesep tempdir tempname matlabroot toolboxdir dbclear dbcont dbdown dbquit dbstack dbstatus dbstep dbstop dbtype dbup checkcode keyboard mlintrpt edit echo eval evalc evalin feval run builtin mfilename pcode uiaxes uibutton uibuttongroup uicheckbox uidropdown uieditfield uilabel uilistbox uiradiobutton uislider uispinner uitable uitextarea uitogglebutton scroll uifigure uipanel uitabgroup uitab uigauge uiknob uilamp uiswitch uialert questdlg inputdlg listdlg uisetcolor uigetfile uiputfile uigetdir uiopen uisave appdesigner figure axes uicontrol uitable uipanel uibuttongroup uitab uitabgroup uimenu uicontextmenu uitoolbar uipushtool uitoggletool actxcontrol align movegui getpixelposition setpixelposition listfonts textwrap uistack inspect errordlg warndlg msgbox helpdlg waitbar questdlg inputdlg listdlg uisetcolor uisetfont export2wsdlg uigetfile uiputfile uigetdir uiopen uisave printdlg printpreview exportsetupdlg dialog uigetpref guide uiwait uiresume waitfor waitforbuttonpress closereq getappdata setappdata isappdata rmappdata guidata guihandles uisetpref class isobject enumeration events methods properties classdef classdef import properties isprop mustbefinite mustbegreaterthan mustbegreaterthanorequal mustbeinteger mustbelessthan mustbelessthanorequal mustbemember mustbenegative mustbenonempty mustbenonnan mustbenonnegative mustbenonpositive mustbenonsparse mustbenonzero mustbenumeric mustbenumericorlogical mustbepositive mustbereal methods ismethod isequal eq events superclasses enumeration isenum numargumentsfromsubscript subsref subsasgn subsindex substruct builtin empty disp display details saveobj loadobj edit metaclass properties methods events superclasses step clone getnuminputs getnumoutputs islocked resetsystemobject releasesystemobject mexext inmem loadlibrary unloadlibrary libisloaded calllib libfunctions libfunctionsview libstruct libpointer import isjava javaaddpath javaarray javachk javaclasspath javamethod javamethodedt javaobject javaobjectedt javarmpath usejava net enablenetfromnetworkdrive cell begininvoke endinvoke combine remove removeall bitand bitor bitxor bitnot actxserver actxcontrol actxcontrollist actxcontrolselect actxgetrunningserver iscom addproperty deleteproperty inspect fieldnames methods methodsview invoke isevent eventlisteners registerevent unregisterallevents unregisterevent isinterface interfaces release move pyversion pyargs pyargs pyargs builddocsearchdb try assert runtests testsuite functiontests runtests testsuite runtests testsuite runperf testsuite timeit tic toc cputime profile bench memory inmem pack memoize clearallmemoizedcaches clipboard computer system dos unix getenv setenv perl winqueryreg commandhistory commandwindow filebrowser workspace getpref setpref addpref rmpref ispref mex execute getchararray putchararray getfullmatrix putfullmatrix getvariable getworkspacedata putworkspacedata maximizecommandwindow minimizecommandwindow regmatlabserver enableservice mex dbmex mexext inmem ver computer mexext dbmex inmem mex mexext matlabwindows matlabmac matlablinux exit quit matlabrc startup finish prefdir preferences version ver verlessthan license ispc ismac isunix isstudent javachk usejava doc help docsearch lookfor demo echodemo) end end end end rouge-2.2.1/lib/rouge/lexers/slim.rb0000644000175000017500000001260313150713277017163 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers # A lexer for the Slim tempalte language # @see http://slim-lang.org class Slim < RegexLexer include Indentation title "Slim" desc 'The Slim template language' tag 'slim' filenames '*.slim' # Ruby identifier characters ruby_chars = /[\w\!\?\@\$]/ # Since you are allowed to wrap lines with a backslash, include \\\n in characters dot = /(\\\n|.)/ def ruby @ruby ||= Ruby.new(options) end def html @html ||= HTML.new(options) end def filters @filters ||= { 'ruby' => ruby, 'erb' => ERB.new(options), 'javascript' => Javascript.new(options), 'css' => CSS.new(options), 'coffee' => Coffeescript.new(options), 'markdown' => Markdown.new(options), 'scss' => Scss.new(options), 'sass' => Sass.new(options) } end start { ruby.reset!; html.reset! } state :root do rule /\s*\n/, Text rule(/\s*/) { |m| token Text; indentation(m[0]) } end state :content do mixin :css rule /\/#{dot}*/, Comment, :indented_block rule /(doctype)(\s+)(.*)/ do groups Name::Namespace, Text::Whitespace, Text pop! end # filters, shamelessly ripped from HAML rule /(\w*):\s*\n/ do |m| token Name::Decorator pop! starts_block :filter_block filter_name = m[1].strip @filter_lexer = self.filters[filter_name] @filter_lexer.reset! unless @filter_lexer.nil? puts " slim: filter #{filter_name.inspect} #{@filter_lexer.inspect}" if @debug end # Text rule %r([\|'](?=\s)) do token Punctuation pop! starts_block :plain_block goto :plain_block end rule /-|==|=/, Punctuation, :ruby_line # Dynamic tags rule /(\*)(#{ruby_chars}+\(.*?\))/ do |m| token Punctuation, m[1] delegate ruby, m[2] push :tag end rule /(\*)(#{ruby_chars}+)/ do |m| token Punctuation, m[1] delegate ruby, m[2] push :tag end #rule /<\w+(?=.*>)/, Keyword::Constant, :tag # Maybe do this, look ahead and stuff rule %r(()) do |m| # Dirty html delegate html, m[1] pop! end # Ordinary slim tags rule /\w+/, Name::Tag, :tag end state :tag do mixin :css mixin :indented_block mixin :interpolation # Whitespace control rule /[<>]/, Punctuation # Trim whitespace rule /\s+?/, Text::Whitespace # Splats, these two might be mergable? rule /(\*)(#{ruby_chars}+)/ do |m| token Punctuation, m[1] delegate ruby, m[2] end rule /(\*)(\{#{dot}+?\})/ do |m| token Punctuation, m[1] delegate ruby, m[2] end # Attributes rule /([\w\-]+)(\s*)(\=)/ do |m| token Name::Attribute, m[1] token Text::Whitespace, m[2] token Punctuation, m[3] push :html_attr end # Ruby value rule /(\=)(#{dot}+)/ do |m| token Punctuation, m[1] #token Keyword::Constant, m[2] delegate ruby, m[2] end # HTML Entities rule(/&\S*?;/, Name::Entity) rule /#{dot}+?/, Text rule /\s*\n/, Text::Whitespace, :pop! end state :css do rule(/\.[\w-]*/) { token Name::Class; goto :tag } rule(/#[a-zA-Z][\w:-]*/) { token Name::Function; goto :tag } end state :html_attr do # Strings, double/single quoted rule(/\s*(['"])#{dot}*?\1/, Literal::String, :pop!) # Ruby stuff rule(/(#{ruby_chars}+\(.*?\))/) { |m| delegate ruby, m[1]; pop! } rule(/(#{ruby_chars}+)/) { |m| delegate ruby, m[1]; pop! } rule /\s+/, Text::Whitespace end state :ruby_line do # Need at top mixin :indented_block rule(/,\s*\n/) { delegate ruby } rule /[ ]\|[ \t]*\n/, Str::Escape rule(/.*?(?=(,$| \|)?[ \t]*$)/) { delegate ruby } end state :filter_block do rule /([^#\n]|#[^{\n]|(\\\\)*\\#\{)+/ do if @filter_lexer delegate @filter_lexer else token Name::Decorator end end mixin :interpolation mixin :indented_block end state :plain_block do mixin :interpolation rule %r(()) do |m| # Dirty html delegate html, m[1] end # HTML Entities rule(/&\S*?;/, Name::Entity) #rule /([^#\n]|#[^{\n]|(\\\\)*\\#\{)+/ do rule /#{dot}+?/, Text mixin :indented_block end state :interpolation do rule /#[{]/, Str::Interpol, :ruby_interp end state :ruby_interp do rule /[}]/, Str::Interpol, :pop! mixin :ruby_interp_inner end state :ruby_interp_inner do rule(/[{]/) { delegate ruby; push :ruby_interp_inner } rule(/[}]/) { delegate ruby; pop! } rule(/[^{}]+/) { delegate ruby } end state :indented_block do rule(/(?/, Name::Variable rule /".*?"/, Str rule /\S+/, Text rule rest_of_line, Text, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/cpp.rb0000644000175000017500000000437413150713277017007 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers load_lexer 'c.rb' class Cpp < C title "C++" desc "The C++ programming language" tag 'cpp' aliases 'c++' # the many varied filenames of c++ source files... filenames '*.cpp', '*.hpp', '*.c++', '*.h++', '*.cc', '*.hh', '*.cxx', '*.hxx', '*.pde', '*.ino', '*.tpp' mimetypes 'text/x-c++hdr', 'text/x-c++src' def self.keywords @keywords ||= super + Set.new(%w( asm auto catch const_cast delete dynamic_cast explicit export friend mutable namespace new operator private protected public reinterpret_cast restrict size_of static_cast template this throw throws typeid typename using virtual final override alignas alignof constexpr decltype noexcept static_assert thread_local try )) end def self.keywords_type @keywords_type ||= super + Set.new(%w( bool )) end def self.reserved @reserved ||= super + Set.new(%w( __virtual_inheritance __uuidof __super __single_inheritance __multiple_inheritance __interface __event )) end id = /[a-zA-Z_][a-zA-Z0-9_]*/ prepend :root do # Offload C++ extensions, http://offload.codeplay.com/ rule /(?:__offload|__blockingoffload|__outer)\b/, Keyword::Pseudo end # digits with optional inner quotes # see www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf dq = /\d('?\d)*/ prepend :statements do rule /class\b/, Keyword, :classname rule %r((#{dq}[.]#{dq}?|[.]#{dq})(e[+-]?#{dq}[lu]*)?)i, Num::Float rule %r(#{dq}e[+-]?#{dq}[lu]*)i, Num::Float rule /0x\h('?\h)*[lu]*/i, Num::Hex rule /0[0-7]('?[0-7])*[lu]*/i, Num::Oct rule /#{dq}[lu]*/i, Num::Integer rule /\bnullptr\b/, Name::Builtin rule /(?:u8|u|U|L)?R"([a-zA-Z0-9_{}\[\]#<>%:;.?*\+\-\/\^&|~!=,"']{,16})\(.*?\)\1"/m, Str end state :classname do rule id, Name::Class, :pop! # template specification rule /\s*(?=>)/m, Text, :pop! mixin :whitespace end end end end rouge-2.2.1/lib/rouge/lexers/apache.rb0000644000175000017500000000323013150713277017434 0ustar uwabamiuwabamirequire 'yaml' module Rouge module Lexers class Apache < RegexLexer title "Apache" desc 'configuration files for Apache web server' tag 'apache' mimetypes 'text/x-httpd-conf', 'text/x-apache-conf' filenames '.htaccess', 'httpd.conf' class << self attr_reader :keywords end # Load Apache keywords from separate YML file @keywords = ::YAML.load_file(Pathname.new(__FILE__).dirname.join('apache/keywords.yml')).tap do |h| h.each do |k,v| h[k] = Set.new v end end def name_for_token(token, kwtype, tktype) if self.class.keywords[kwtype].include? token tktype else Text end end state :whitespace do rule /\#.*/, Comment rule /\s+/m, Text end state :root do mixin :whitespace rule /(<\/?)(\w+)/ do |m| groups Punctuation, name_for_token(m[2].downcase, :sections, Name::Label) push :section end rule /\w+/ do |m| token name_for_token(m[0].downcase, :directives, Name::Class) push :directive end end state :section do # Match section arguments rule /([^>]+)?(>(?:\r\n?|\n)?)/ do |m| groups Literal::String::Regex, Punctuation pop! end mixin :whitespace end state :directive do # Match value literals and other directive arguments rule /\r\n?|\n/, Text, :pop! mixin :whitespace rule /\S+/ do |m| token name_for_token(m[0], :values, Literal::String::Symbol) end end end end end rouge-2.2.1/lib/rouge/lexers/graphql.rb0000644000175000017500000001255513150713277017663 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class GraphQL < RegexLexer desc 'GraphQL' tag 'graphql' filenames '*.graphql', '*.gql' mimetypes 'application/graphql' name = /[_A-Za-z][_0-9A-Za-z]*/ state :root do rule /\b(?:query|mutation|subscription)\b/, Keyword, :query_definition rule /\{/ do token Punctuation push :query_definition push :selection_set end rule /\bfragment\b/, Keyword, :fragment_definition rule /\b(?:type|interface|enum)\b/, Keyword, :type_definition rule /\b(?:input|schema)\b/, Keyword, :type_definition rule /\bunion\b/, Keyword, :union_definition mixin :basic end state :basic do rule /\s+/m, Text::Whitespace rule /#.*$/, Comment rule /[!,]/, Punctuation end state :has_directives do rule /(@#{name})(\s*)(\()/ do groups Keyword, Text::Whitespace, Punctuation push :arguments end rule /@#{name}\b/, Keyword end state :fragment_definition do rule /\bon\b/, Keyword mixin :query_definition end state :query_definition do mixin :has_directives rule /\b#{name}\b/, Name rule /\(/, Punctuation, :variable_definitions rule /\{/, Punctuation, :selection_set mixin :basic end state :type_definition do rule /\bimplements\b/, Keyword rule /\b#{name}\b/, Name rule /\(/, Punctuation, :variable_definitions rule /\{/, Punctuation, :type_definition_set mixin :basic end state :union_definition do rule /\b#{name}\b/, Name rule /\=/, Punctuation, :union_definition_variant mixin :basic end state :union_definition_variant do rule /\b#{name}\b/ do token Name pop! push :union_definition_pipe end mixin :basic end state :union_definition_pipe do rule /\|/ do token Punctuation pop! push :union_definition_variant end rule /(?!\||\s+|#[^\n]*)/ do pop! 2 end mixin :basic end state :type_definition_set do rule /\}/ do token Punctuation pop! 2 end rule /\b(#{name})(\s*)(\()/ do groups Name, Text::Whitespace, Punctuation push :variable_definitions end rule /\b#{name}\b/, Name rule /:/, Punctuation, :type_names mixin :basic end state :arguments do rule /\)/ do token Punctuation pop! end rule /\b#{name}\b/, Name rule /:/, Punctuation, :value mixin :basic end state :variable_definitions do rule /\)/ do token Punctuation pop! end rule /\$#{name}\b/, Name::Variable rule /\b#{name}\b/, Name rule /:/, Punctuation, :type_names rule /\=/, Punctuation, :value mixin :basic end state :type_names do rule /\b(?:Int|Float|String|Boolean|ID)\b/, Name::Builtin, :pop! rule /\b#{name}\b/, Name, :pop! rule /\[/, Punctuation, :type_name_list mixin :basic end state :type_name_list do rule /\b(?:Int|Float|String|Boolean|ID)\b/, Name::Builtin rule /\b#{name}\b/, Name rule /\]/ do token Punctuation pop! 2 end mixin :basic end state :selection_set do mixin :has_directives rule /\}/ do token Punctuation pop! pop! if state?(:query_definition) || state?(:fragment_definition) end rule /\b(#{name})(\s*)(\()/ do groups Name, Text::Whitespace, Punctuation push :arguments end rule /\b(#{name})(\s*)(:)/ do groups Name, Text::Whitespace, Punctuation end rule /\b#{name}\b/, Name rule /(\.\.\.)(\s+)(on)\b/ do groups Punctuation, Text::Whitespace, Keyword end rule /\.\.\./, Punctuation rule /\{/, Punctuation, :selection_set mixin :basic end state :list do rule /\]/ do token Punctuation pop! pop! if state?(:value) end mixin :value end state :object do rule /\}/ do token Punctuation pop! pop! if state?(:value) end rule /\b(#{name})(\s*)(:)/ do groups Name, Text::Whitespace, Punctuation push :value end mixin :basic end state :value do pop_unless_list = ->(t) { ->(m) { token t pop! unless state?(:list) } } rule /\$#{name}\b/, &pop_unless_list[Name::Variable] rule /\b(?:true|false|null)\b/, &pop_unless_list[Keyword::Constant] rule /[+-]?[0-9]+\.[0-9]+(?:[eE][+-]?[0-9]+)?/, &pop_unless_list[Num::Float] rule /[+-]?[1-9][0-9]*(?:[eE][+-]?[0-9]+)?/, &pop_unless_list[Num::Integer] rule /"(\\[\\"]|[^"])*"/, &pop_unless_list[Str::Double] rule /\b#{name}\b/, &pop_unless_list[Name] rule /\{/, Punctuation, :object rule /\[/, Punctuation, :list mixin :basic end end end end rouge-2.2.1/lib/rouge/lexers/clojure.rb0000644000175000017500000001045213150713277017662 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Clojure < RegexLexer title "Clojure" desc "The Clojure programming language (clojure.org)" tag 'clojure' aliases 'clj', 'cljs' filenames '*.clj', '*.cljs', '*.cljc', 'build.boot', '*.edn' mimetypes 'text/x-clojure', 'application/x-clojure' def self.keywords @keywords ||= Set.new %w( fn def defn defmacro defmethod defmulti defn- defstruct if cond let for ) end def self.builtins @builtins ||= Set.new %w( . .. * + - -> / < <= = == > >= accessor agent agent-errors aget alength all-ns alter and append-child apply array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc await await-for bean binding bit-and bit-not bit-or bit-shift-left bit-shift-right bit-xor boolean branch? butlast byte cast char children class clear-agent-errors comment commute comp comparator complement concat conj cons constantly construct-proxy contains? count create-ns create-struct cycle dec deref difference disj dissoc distinct doall doc dorun doseq dosync dotimes doto double down drop drop-while edit end? ensure eval every? false? ffirst file-seq filter find find-doc find-ns find-var first float flush fnseq frest gensym get-proxy-class get hash-map hash-set identical? identity if-let import in-ns inc index insert-child insert-left insert-right inspect-table inspect-tree instance? int interleave intersection into into-array iterate join key keys keyword keyword? last lazy-cat lazy-cons left lefts line-seq list* list load load-file locking long loop macroexpand macroexpand-1 make-array make-node map map-invert map? mapcat max max-key memfn merge merge-with meta min min-key name namespace neg? new newline next nil? node not not-any? not-every? not= ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unmap nth nthrest or parse partial path peek pop pos? pr pr-str print print-str println println-str prn prn-str project proxy proxy-mappings quot rand rand-int range re-find re-groups re-matcher re-matches re-pattern re-seq read read-line reduce ref ref-set refer rem remove remove-method remove-ns rename rename-keys repeat replace replicate resolve rest resultset-seq reverse rfirst right rights root rrest rseq second select select-keys send send-off seq seq-zip seq? set short slurp some sort sort-by sorted-map sorted-map-by sorted-set special-symbol? split-at split-with str string? struct struct-map subs subvec symbol symbol? sync take take-nth take-while test time to-array to-array-2d tree-seq true? union up update-proxy val vals var-get var-set var? vector vector-zip vector? when when-first when-let when-not with-local-vars with-meta with-open with-out-str xml-seq xml-zip zero? zipmap zipper' ) end identifier = %r([\w!$%*+,<=>?/.-]+) keyword = %r([\w!\#$%*+,<=>?/.-]+) def name_token(name) return Keyword if self.class.keywords.include?(name) return Name::Builtin if self.class.builtins.include?(name) nil end state :root do rule /;.*?$/, Comment::Single rule /\s+/m, Text::Whitespace rule /-?\d+\.\d+/, Num::Float rule /-?\d+/, Num::Integer rule /0x-?[0-9a-fA-F]+/, Num::Hex rule /"(\\.|[^"])*"/, Str rule /'#{keyword}/, Str::Symbol rule /::?#{keyword}/, Name::Constant rule /\\(.|[a-z]+)/i, Str::Char rule /~@|[`\'#^~&@]/, Operator rule /(\()(\s*)(#{identifier})/m do |m| token Punctuation, m[1] token Text::Whitespace, m[2] token(name_token(m[3]) || Name::Function, m[3]) end rule identifier do |m| token name_token(m[0]) || Name end # vectors rule /[\[\]]/, Punctuation # maps rule /[{}]/, Punctuation # parentheses rule /[()]/, Punctuation end end end end rouge-2.2.1/lib/rouge/lexers/qml.rb0000644000175000017500000000362013150713277017007 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers load_lexer 'javascript.rb' class Qml < Javascript title "QML" desc 'QML, a UI markup language' tag 'qml' aliases 'qml' filenames '*.qml' mimetypes 'application/x-qml', 'text/x-qml' id_with_dots = /[$a-zA-Z_][a-zA-Z0-9_.]*/ prepend :root do rule /(#{id_with_dots})(\s*)({)/ do groups Keyword::Type, Text, Punctuation push :type_block end rule /(#{id_with_dots})(\s+)(on)(\s+)(#{id_with_dots})(\s*)({)/ do groups Keyword::Type, Text, Keyword, Text, Name::Label, Text, Punctuation push :type_block end rule /[{]/, Punctuation, :push end state :type_block do rule /(id)(\s*)(:)(\s*)(#{id_with_dots})/ do groups Name::Label, Text, Punctuation, Text, Keyword::Declaration end rule /(#{id_with_dots})(\s*)(:)/ do groups Name::Label, Text, Punctuation push :expr_start end rule /(signal)(\s+)(#{id_with_dots})/ do groups Keyword::Declaration, Text, Name::Label push :signal end rule /(property)(\s+)(#{id_with_dots})(\s+)(#{id_with_dots})(\s*)(:?)/ do groups Keyword::Declaration, Text, Keyword::Type, Text, Name::Label, Text, Punctuation push :expr_start end rule /[}]/, Punctuation, :pop! mixin :root end state :signal do mixin :comments_and_whitespace rule /\(/ do token Punctuation goto :signal_args end rule //, Text, :pop! end state :signal_args do mixin :comments_and_whitespace rule /(#{id_with_dots})(\s+)(#{id_with_dots})(\s*)(,?)/ do groups Keyword::Type, Text, Name, Text, Punctuation end rule /\)/ , Punctuation, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/julia.rb0000644000175000017500000001475613150713277017336 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Julia < RegexLexer title "Julia" desc "The Julia programming language" tag 'julia' aliases 'jl' filenames '*.jl' mimetypes 'text/x-julia', 'application/x-julia' def self.analyze_text(text) 1 if text.shebang? 'julia' end BUILTINS = /\b(?: applicable | assert | convert | dlopen | dlsym | edit | eps | error | exit | finalizer | hash | im | Inf | invoke | is | isa | isequal | load | method_exists | Nan | new | ntuple | pi | promote | promote_type | realmax | realmin | sizeof | subtype | system | throw | tuple | typemax | typemin | typeof | uid | whos )\b/x KEYWORDS = /\b(?: function | return | module | import | export | if | else | elseif | end | for | in | while | try | catch | super | const )\b/x TYPES = /\b(?: Int | UInt | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Float16 | Float32 | Float64 | Bool | Inf | Inf16 | Inf32 | NaN | NaN16 | NaN32 | BigInt | BigFloat | Char | ASCIIString | UTF8String | UTF16String | UTF32String | AbstractString | WString | String | Regex | RegexMatch | Complex64 | Complex128 | Any | Nothing | None )\b/x OPERATORS = / \+ | = | - | \* | \/ | \\ | & | \| | \$ | ~ | \^ | % | ! | >>> | >> | << | && | \|\| | \+= | -= | \*= | \/= | \\= | ÷= | %= | \^= | &= | \|= | \$= | >>>= | >>= | <<= | == | != | ≠ | <= | ≤ | >= | ≥ | \. | :: | <: | -> | \? | \.\* | \.\^ | \.\\ | \.\/ | \\ | < | > /x PUNCTUATION = / [ \[ \] { } : \( \) , ; @ ] /x state :root do rule /\n/, Text rule /[^\S\n]+/, Text rule /#=/, Comment::Multiline, :blockcomment rule /#.*$/, Comment rule OPERATORS, Operator rule /\\\n/, Text rule /\\/, Text # functions rule /(function)((?:\s|\\\s)+)/ do groups Keyword, Name::Function push :funcname end # types rule /(type|typealias|abstract)((?:\s|\\\s)+)/ do groups Keyword, Name::Class push :typename end rule TYPES, Keyword::Type # keywords rule /(local|global|const)\b/, Keyword::Declaration rule KEYWORDS, Keyword rule BUILTINS, Name::Builtin # backticks rule /`.*?`/, Literal::String::Backtick # chars rule /'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,3}|\\u[a-fA-F0-9]{1,4}|\\U[a-fA-F0-9]{1,6}|[^\\\'\n])'/, Literal::String::Char # try to match trailing transpose rule /(?<=[.\w)\]])\'+/, Operator # strings rule /(?:[IL])"/, Literal::String, :string rule /[E]?"/, Literal::String, :string # names rule /@[\w.]+/, Name::Decorator rule /(?:[a-zA-Z_\u00A1-\uffff]|[\u1000-\u10ff])(?:[a-zA-Z_0-9\u00A1-\uffff]|[\u1000-\u10ff])*!*/, Name rule PUNCTUATION, Other # numbers rule /(\d+(_\d+)+\.\d*|\d*\.\d+(_\d+)+)([eEf][+-]?[0-9]+)?/, Literal::Number::Float rule /(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?/, Literal::Number::Float rule /\d+(_\d+)+[eEf][+-]?[0-9]+/, Literal::Number::Float rule /\d+[eEf][+-]?[0-9]+/, Literal::Number::Float rule /0b[01]+(_[01]+)+/, Literal::Number::Bin rule /0b[01]+/, Literal::Number::Bin rule /0o[0-7]+(_[0-7]+)+/, Literal::Number::Oct rule /0o[0-7]+/, Literal::Number::Oct rule /0x[a-fA-F0-9]+(_[a-fA-F0-9]+)+/, Literal::Number::Hex rule /0x[a-fA-F0-9]+/, Literal::Number::Hex rule /\d+(_\d+)+/, Literal::Number::Integer rule /\d+/, Literal::Number::Integer end state :funcname do rule /[a-zA-Z_]\w*/, Name::Function, :pop! rule /\([^\s\w{]{1,2}\)/, Operator, :pop! rule /[^\s\w{]{1,2}/, Operator, :pop! end state :typename do rule /[a-zA-Z_]\w*/, Name::Class, :pop! end state :stringescape do rule /\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})/, Literal::String::Escape end state :blockcomment do rule /[^=#]/, Comment::Multiline rule /#=/, Comment::Multiline, :blockcomment rule /\=#/, Comment::Multiline, :pop! rule /[=#]/, Comment::Multiline end state :string do mixin :stringescape rule /"/, Literal::String, :pop! rule /\\\\|\\"|\\\n/, Literal::String::Escape # included here for raw strings rule /\$(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?/, Literal::String::Interpol rule /[^\\"$]+/, Literal::String # quotes, dollar signs, and backslashes must be parsed one at a time rule /["\\]/, Literal::String # unhandled string formatting sign rule /\$/, Literal::String end end end end rouge-2.2.1/lib/rouge/lexers/lasso/0000755000175000017500000000000013150713277017011 5ustar uwabamiuwabamirouge-2.2.1/lib/rouge/lexers/lasso/keywords.yml0000644000175000017500000002146413150713277021412 0ustar uwabamiuwabami:keywords: - "cache" - "database_names" - "database_schemanames" - "database_tablenames" - "define_tag" - "define_type" - "email_batch" - "encode_set" - "html_comment" - "handle" - "handle_error" - "header" - "if" - "inline" - "iterate" - "ljax_target" - "link" - "link_currentaction" - "link_currentgroup" - "link_currentrecord" - "link_detail" - "link_firstgroup" - "link_firstrecord" - "link_lastgroup" - "link_lastrecord" - "link_nextgroup" - "link_nextrecord" - "link_prevgroup" - "link_prevrecord" - "log" - "loop" - "namespace_using" - "output_none" - "portal" - "private" - "protect" - "records" - "referer" - "referrer" - "repeating" - "resultset" - "rows" - "search_args" - "search_arguments" - "select" - "sort_args" - "sort_arguments" - "thread_atomic" - "value_list" - "while" - "abort" - "case" - "else" - "fail_if" - "fail_ifnot" - "fail" - "if_empty" - "if_false" - "if_null" - "if_true" - "loop_abort" - "loop_continue" - "loop_count" - "params" - "params_up" - "return" - "return_value" - "run_children" - "soap_definetag" - "soap_lastrequest" - "soap_lastresponse" - "tag_name" - "ascending" - "average" - "by" - "define" - "descending" - "do" - "equals" - "frozen" - "group" - "handle_failure" - "import" - "in" - "into" - "join" - "let" - "match" - "max" - "min" - "on" - "order" - "parent" - "protected" - "provide" - "public" - "require" - "returnhome" - "skip" - "split_thread" - "sum" - "take" - "thread" - "to" - "trait" - "type" - "where" - "with" - "yield" - "yieldhome" :types_traits: - "atbegin" - "bson_iter" - "bson" - "bytes_document_body" - "cache_server_element" - "cache_server" - "capture" - "client_address" - "client_ip" - "component_container" - "component_render_state" - "component" - "curl" - "curltoken" - "currency" - "custom" - "data_document" - "database_registry" - "dateandtime" - "dbgp_packet" - "dbgp_server" - "debugging_stack" - "delve" - "dir" - "dirdesc" - "dns_response" - "document_base" - "document_body" - "document_header" - "dsinfo" - "eacher" - "email_compose" - "email_parse" - "email_pop" - "email_queue_impl_base" - "email_queue_impl" - "email_smtp" - "email_stage_impl_base" - "email_stage_impl" - "fastcgi_each_fcgi_param" - "fastcgi_server" - "fcgi_record" - "fcgi_request" - "file" - "filedesc" - "filemaker_datasource" - "generateforeachkeyed" - "generateforeachunkeyed" - "generateseries" - "hash_map" - "html_atomic_element" - "html_attr" - "html_base" - "html_binary" - "html_br" - "html_cdata" - "html_container_element" - "html_div" - "html_document_body" - "html_document_head" - "html_eol" - "html_fieldset" - "html_form" - "html_h1" - "html_h2" - "html_h3" - "html_h4" - "html_h5" - "html_h6" - "html_hr" - "html_img" - "html_input" - "html_json" - "html_label" - "html_legend" - "html_link" - "html_meta" - "html_object" - "html_option" - "html_raw" - "html_script" - "html_select" - "html_span" - "html_style" - "html_table" - "html_td" - "html_text" - "html_th" - "html_tr" - "http_document_header" - "http_document" - "http_error" - "http_header_field" - "http_server_connection_handler_globals" - "http_server_connection_handler" - "http_server_request_logger_thread" - "http_server_web_connection" - "http_server" - "image" - "include_cache" - "inline_type" - "java_jnienv" - "jbyte" - "jbytearray" - "jchar" - "jchararray" - "jfieldid" - "jfloat" - "jint" - "jmethodid" - "jobject" - "jshort" - "json_decode" - "json_encode" - "json_literal" - "json_object" - "lassoapp_compiledsrc_appsource" - "lassoapp_compiledsrc_fileresource" - "lassoapp_content_rep_halt" - "lassoapp_dirsrc_appsource" - "lassoapp_dirsrc_fileresource" - "lassoapp_installer" - "lassoapp_livesrc_appsource" - "lassoapp_livesrc_fileresource" - "lassoapp_long_expiring_bytes" - "lassoapp_manualsrc_appsource" - "lassoapp_zip_file_server" - "lassoapp_zipsrc_appsource" - "lassoapp_zipsrc_fileresource" - "ldap" - "library_thread_loader" - "list_node" - "log_impl_base" - "log_impl" - "magick_image" - "map_node" - "memberstream" - "memory_session_driver_impl_entry" - "memory_session_driver_impl" - "memory_session_driver" - "mime_reader" - "mongo_client" - "mongo_collection" - "mongo_cursor" - "mustache_ctx" - "mysql_session_driver_impl" - "mysql_session_driver" - "net_named_pipe" - "net_tcp_ssl" - "net_tcp" - "net_udp_packet" - "net_udp" - "odbc_session_driver_impl" - "odbc_session_driver" - "opaque" - "os_process" - "pair_compare" - "pairup" - "pdf_barcode" - "pdf_chunk" - "pdf_color" - "pdf_doc" - "pdf_font" - "pdf_hyphenator" - "pdf_image" - "pdf_list" - "pdf_paragraph" - "pdf_phrase" - "pdf_read" - "pdf_table" - "pdf_text" - "pdf_typebase" - "percent" - "portal_impl" - "queriable_groupby" - "queriable_grouping" - "queriable_groupjoin" - "queriable_join" - "queriable_orderby" - "queriable_orderbydescending" - "queriable_select" - "queriable_selectmany" - "queriable_skip" - "queriable_take" - "queriable_thenby" - "queriable_thenbydescending" - "queriable_where" - "raw_document_body" - "regexp" - "repeat" - "scientific" - "security_registry" - "serialization_element" - "serialization_object_identity_compare" - "serialization_reader" - "serialization_writer_ref" - "serialization_writer_standin" - "serialization_writer" - "session_delete_expired_thread" - "signature" - "sourcefile" - "sqlite_column" - "sqlite_currentrow" - "sqlite_db" - "sqlite_results" - "sqlite_session_driver_impl_entry" - "sqlite_session_driver_impl" - "sqlite_session_driver" - "sqlite_table" - "sqlite3_stmt" - "sqlite3" - "sys_process" - "text_document" - "tie" - "timeonly" - "tree_base" - "tree_node" - "tree_nullnode" - "ucal" - "usgcpu" - "usgvm" - "web_error_atend" - "web_node_base" - "web_node_content_representation_css_specialized" - "web_node_content_representation_html_specialized" - "web_node_content_representation_js_specialized" - "web_node_content_representation_xhr_container" - "web_node_echo" - "web_node_root" - "web_request_impl" - "web_request" - "web_response_impl" - "web_response" - "web_router" - "websocket_handler" - "worker_pool" - "xml_attr" - "xml_cdatasection" - "xml_characterdata" - "xml_comment" - "xml_document" - "xml_documentfragment" - "xml_documenttype" - "xml_domimplementation" - "xml_element" - "xml_entity" - "xml_entityreference" - "xml_namednodemap_attr" - "xml_namednodemap_ht" - "xml_namednodemap" - "xml_node" - "xml_nodelist" - "xml_notation" - "xml_processinginstruction" - "xml_text" - "xmlstream" - "zip_file_impl" - "zip_file" - "zip_impl" - "zip" - "any" - "formattingbase" - "html_attributed" - "html_element_coreattrs" - "html_element_eventsattrs" - "html_element_i18nattrs" - "lassoapp_capabilities" - "lassoapp_resource" - "lassoapp_source" - "queriable_asstring" - "session_driver" - "trait_array" - "trait_asstring" - "trait_backcontractible" - "trait_backended" - "trait_backexpandable" - "trait_close" - "trait_contractible" - "trait_decompose_assignment" - "trait_doubleended" - "trait_each_sub" - "trait_encodeurl" - "trait_endedfullymutable" - "trait_expandable" - "trait_file" - "trait_finite" - "trait_finiteforeach" - "trait_foreach" - "trait_foreachtextelement" - "trait_frontcontractible" - "trait_frontended" - "trait_frontexpandable" - "trait_fullymutable" - "trait_generator" - "trait_generatorcentric" - "trait_hashable" - "trait_json_serialize" - "trait_keyed" - "trait_keyedfinite" - "trait_keyedforeach" - "trait_keyedmutable" - "trait_list" - "trait_map" - "trait_net" - "trait_pathcomponents" - "trait_positionallykeyed" - "trait_positionallysearchable" - "trait_queriable" - "trait_queriablelambda" - "trait_readbytes" - "trait_readstring" - "trait_scalar" - "trait_searchable" - "trait_serializable" - "trait_setencoding" - "trait_setoperations" - "trait_stack" - "trait_treenode" - "trait_writebytes" - "trait_writestring" - "trait_xml_elementcompat" - "trait_xml_nodecompat" - "web_connection" - "web_node_container" - "web_node_content_css_specialized" - "web_node_content_document" - "web_node_content_html_specialized" - "web_node_content_js_specialized" - "web_node_content_json_specialized" - "web_node_content_representation" - "web_node_content" - "web_node_postable" - "web_node" rouge-2.2.1/lib/rouge/lexers/hylang.rb0000644000175000017500000000604213150713277017501 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class HyLang < RegexLexer title "HyLang" desc "The HyLang programming language (hylang.org)" tag 'hylang' aliases 'hy' filenames '*.hy' mimetypes 'text/x-hy', 'application/x-hy' def self.keywords @keywords ||= Set.new %w( False None True and as assert break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try ) end def self.builtins @builtins ||= Set.new %w( != % %= & &= * ** **= *= *map + += , - -= -> ->> . / // //= /= < << <<= <= = > >= >> >>= @ @= ^ ^= accumulate apply as-> assoc butlast calling-module-name car cdr chain coll? combinations comp complement compress cond cons cons? constantly count cut cycle dec defclass defmacro defmacro! defmacro/g! defmain defn defreader dict-comp disassemble dispatch-reader-macro distinct do doto drop drop-last drop-while empty? eval eval-and-compile eval-when-compile even? every? filter first flatten float? fn for* fraction genexpr gensym get group-by identity if* if-not if-python2 inc input instance? integer integer-char? integer? interleave interpose islice iterable? iterate iterator? juxt keyword keyword? last let lif lif-not list* list-comp macro-error macroexpand macroexpand-1 map merge-with multicombinations name neg? none? not-in not? nth numeric? odd? partition permutations pos? product quasiquote quote range read read-str reduce remove repeat repeatedly require rest second set-comp setv some string string? symbol? take take-nth take-while tee unless unquote unquote-splicing when with* with-decorator with-gensyms xor yield-from zero? zip zip-longest | |= ~ ) end identifier = %r([\w!$%*+,<=>?/.-]+) keyword = %r([\w!\#$%*+,<=>?/.-]+) def name_token(name) return Keyword if self.class.keywords.include?(name) return Name::Builtin if self.class.builtins.include?(name) nil end state :root do rule /;.*?$/, Comment::Single rule /\s+/m, Text::Whitespace rule /-?\d+\.\d+/, Num::Float rule /-?\d+/, Num::Integer rule /0x-?[0-9a-fA-F]+/, Num::Hex rule /"(\\.|[^"])*"/, Str rule /'#{keyword}/, Str::Symbol rule /::?#{keyword}/, Name::Constant rule /\\(.|[a-z]+)/i, Str::Char rule /~@|[`\'#^~&@]/, Operator rule /(\()(\s*)(#{identifier})/m do |m| token Punctuation, m[1] token Text::Whitespace, m[2] token(name_token(m[3]) || Name::Function, m[3]) end rule identifier do |m| token name_token(m[0]) || Name end # vectors rule /[\[\]]/, Punctuation # maps rule /[{}]/, Punctuation # parentheses rule /[()]/, Punctuation end end end end rouge-2.2.1/lib/rouge/lexers/r.rb0000644000175000017500000000630513150713277016462 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class R < RegexLexer title "R" desc 'The R statistics language (r-project.org)' tag 'r' aliases 'r', 'R', 's', 'S' filenames '*.R', '*.r', '.Rhistory', '.Rprofile' mimetypes 'text/x-r-source', 'text/x-r', 'text/x-R' mimetypes 'text/x-r', 'application/x-r' KEYWORDS = %w(if else for while repeat in next break function) KEYWORD_CONSTANTS = %w( NULL Inf TRUE FALSE NaN NA NA_integer_ NA_real_ NA_complex_ NA_character_ ) BUILTIN_CONSTANTS = %w(LETTERS letters month.abb month.name pi T F) # These are all the functions in `base` that are implemented as a # `.Primitive`, minus those functions that are also keywords. PRIMITIVE_FUNCTIONS = %w( abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm ) def self.analyze_text(text) return 1 if text.shebang? 'Rscript' end state :root do rule /#'.*?$/, Comment::Doc rule /#.*?$/, Comment::Single rule /\s+/m, Text::Whitespace rule /`[^`]+?`/, Name rule /'(\\.|.)*?'/m, Str::Single rule /"(\\.|.)*?"/m, Str::Double rule /%[^%]*?%/, Operator rule /0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?/, Num::Hex rule /[+-]?(\d+([.]\d+)?|[.]\d+)([eE][+-]?\d+)?[Li]?/, Num # Only recognize built-in functions when they are actually used as a # function call, i.e. followed by an opening parenthesis. # `Name::Builtin` would be more logical, but is usually not # highlighted specifically; thus use `Name::Function`. rule /\b(??*+^/!=~$@:%&|]), Operator end end end end rouge-2.2.1/lib/rouge/lexers/powershell.rb0000644000175000017500000013523613150713277020413 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers load_lexer 'shell.rb' class Powershell < Shell title 'powershell' desc 'powershell' tag 'powershell' aliases 'posh' filenames '*.ps1', '*.psm1', '*.psd1' mimetypes 'text/x-powershell' ATTRIBUTES = %w( CmdletBinding ConfirmImpact DefaultParameterSetName HelpURI SupportsPaging SupportsShouldProcess PositionalBinding ).join('|') KEYWORDS = %w( Begin Exit Process Break Filter Return Catch Finally Sequence Class For Switch Continue ForEach Throw Data From Trap Define Function Try Do If Until DynamicParam In Using Else InlineScript Var ElseIf Parallel While End Param Workflow ).join('|') KEYWORDS_TYPE = %w( bool byte char decimal double float int long object sbyte short string uint ulong ushort ).join('|') OPERATORS = %w( -split -isplit -csplit -join -is -isnot -as -eq -ieq -ceq -ne -ine -cne -gt -igt -cgt -ge -ige -cge -lt -ilt -clt -le -ile -cle -like -ilike -clike -notlike -inotlike -cnotlike -match -imatch -cmatch -notmatch -inotmatch -cnotmatch -contains -icontains -ccontains -notcontains -inotcontains -cnotcontains -replace -ireplace -creplace -band -bor -bxor -and -or -xor \. & = \+= -= \*= \/= %= ).join('|') BUILTINS = %w( Add-ProvisionedAppxPackage Add-WindowsFeature Apply-WindowsUnattend Begin-WebCommitDelay Disable-PhysicalDiskIndication Disable-StorageDiagnosticLog Enable-PhysicalDiskIndication Enable-StorageDiagnosticLog End-WebCommitDelay Expand-IscsiVirtualDisk Flush-Volume Get-DiskSNV Get-PhysicalDiskSNV Get-ProvisionedAppxPackage Get-StorageEnclosureSNV Initialize-Volume Move-SmbClient Remove-ProvisionedAppxPackage Remove-WindowsFeature Write-FileSystemCache Add-BCDataCacheExtension Add-DnsClientNrptRule Add-DtcClusterTMMapping Add-EtwTraceProvider Add-InitiatorIdToMaskingSet Add-MpPreference Add-NetEventNetworkAdapter Add-NetEventPacketCaptureProvider Add-NetEventProvider Add-NetEventVFPProvider Add-NetEventVmNetworkAdapter Add-NetEventVmSwitch Add-NetEventVmSwitchProvider Add-NetEventWFPCaptureProvider Add-NetIPHttpsCertBinding Add-NetLbfoTeamMember Add-NetLbfoTeamNic Add-NetNatExternalAddress Add-NetNatStaticMapping Add-NetSwitchTeamMember Add-OdbcDsn Add-PartitionAccessPath Add-PhysicalDisk Add-Printer Add-PrinterDriver Add-PrinterPort Add-RDServer Add-RDSessionHost Add-RDVirtualDesktopToCollection Add-TargetPortToMaskingSet Add-VirtualDiskToMaskingSet Add-VpnConnection Add-VpnConnectionRoute Add-VpnConnectionTriggerApplication Add-VpnConnectionTriggerDnsConfiguration Add-VpnConnectionTriggerTrustedNetwork Block-FileShareAccess Block-SmbShareAccess Clear-AssignedAccess Clear-BCCache Clear-Disk Clear-DnsClientCache Clear-FileStorageTier Clear-PcsvDeviceLog Clear-StorageDiagnosticInfo Close-SmbOpenFile Close-SmbSession Compress-Archive Configuration Connect-IscsiTarget Connect-VirtualDisk ConvertFrom-SddlString Copy-NetFirewallRule Copy-NetIPsecMainModeCryptoSet Copy-NetIPsecMainModeRule Copy-NetIPsecPhase1AuthSet Copy-NetIPsecPhase2AuthSet Copy-NetIPsecQuickModeCryptoSet Copy-NetIPsecRule Debug-FileShare Debug-MMAppPrelaunch Debug-StorageSubSystem Debug-Volume Disable-BC Disable-BCDowngrading Disable-BCServeOnBattery Disable-DAManualEntryPointSelection Disable-DscDebug Disable-MMAgent Disable-NetAdapter Disable-NetAdapterBinding Disable-NetAdapterChecksumOffload Disable-NetAdapterEncapsulatedPacketTaskOffload Disable-NetAdapterIPsecOffload Disable-NetAdapterLso Disable-NetAdapterPacketDirect Disable-NetAdapterPowerManagement Disable-NetAdapterQos Disable-NetAdapterRdma Disable-NetAdapterRsc Disable-NetAdapterRss Disable-NetAdapterSriov Disable-NetAdapterVmq Disable-NetDnsTransitionConfiguration Disable-NetFirewallRule Disable-NetIPHttpsProfile Disable-NetIPsecMainModeRule Disable-NetIPsecRule Disable-NetNatTransitionConfiguration Disable-NetworkSwitchEthernetPort Disable-NetworkSwitchFeature Disable-NetworkSwitchVlan Disable-OdbcPerfCounter Disable-PhysicalDiskIdentification Disable-PnpDevice Disable-PSTrace Disable-PSWSManCombinedTrace Disable-RDVirtualDesktopADMachineAccountReuse Disable-ScheduledTask Disable-ServerManagerStandardUserRemoting Disable-SmbDelegation Disable-StorageEnclosureIdentification Disable-StorageHighAvailability Disable-StorageMaintenanceMode Disable-Ual Disable-WdacBidTrace Disable-WSManTrace Disconnect-IscsiTarget Disconnect-NfsSession Disconnect-RDUser Disconnect-VirtualDisk Dismount-DiskImage Enable-BCDistributed Enable-BCDowngrading Enable-BCHostedClient Enable-BCHostedServer Enable-BCLocal Enable-BCServeOnBattery Enable-DAManualEntryPointSelection Enable-DscDebug Enable-MMAgent Enable-NetAdapter Enable-NetAdapterBinding Enable-NetAdapterChecksumOffload Enable-NetAdapterEncapsulatedPacketTaskOffload Enable-NetAdapterIPsecOffload Enable-NetAdapterLso Enable-NetAdapterPacketDirect Enable-NetAdapterPowerManagement Enable-NetAdapterQos Enable-NetAdapterRdma Enable-NetAdapterRsc Enable-NetAdapterRss Enable-NetAdapterSriov Enable-NetAdapterVmq Enable-NetDnsTransitionConfiguration Enable-NetFirewallRule Enable-NetIPHttpsProfile Enable-NetIPsecMainModeRule Enable-NetIPsecRule Enable-NetNatTransitionConfiguration Enable-NetworkSwitchEthernetPort Enable-NetworkSwitchFeature Enable-NetworkSwitchVlan Enable-OdbcPerfCounter Enable-PhysicalDiskIdentification Enable-PnpDevice Enable-PSTrace Enable-PSWSManCombinedTrace Enable-RDVirtualDesktopADMachineAccountReuse Enable-ScheduledTask Enable-ServerManagerStandardUserRemoting Enable-SmbDelegation Enable-StorageEnclosureIdentification Enable-StorageHighAvailability Enable-StorageMaintenanceMode Enable-Ual Enable-WdacBidTrace Enable-WSManTrace Expand-Archive Export-BCCachePackage Export-BCSecretKey Export-IscsiTargetServerConfiguration Export-ODataEndpointProxy Export-RDPersonalSessionDesktopAssignment Export-RDPersonalVirtualDesktopAssignment Export-ScheduledTask Find-NetIPsecRule Find-NetRoute Format-Hex Format-Volume Get-AppBackgroundTask Get-AppvVirtualProcess Get-AppxLastError Get-AppxLog Get-AssignedAccess Get-AutologgerConfig Get-BCClientConfiguration Get-BCContentServerConfiguration Get-BCDataCache Get-BCDataCacheExtension Get-BCHashCache Get-BCHostedCacheServerConfiguration Get-BCNetworkConfiguration Get-BCStatus Get-ClusteredScheduledTask Get-DAClientExperienceConfiguration Get-DAConnectionStatus Get-DAEntryPointTableItem Get-DedupProperties Get-Disk Get-DiskImage Get-DiskStorageNodeView Get-DisplayResolution Get-DnsClient Get-DnsClientCache Get-DnsClientGlobalSetting Get-DnsClientNrptGlobal Get-DnsClientNrptPolicy Get-DnsClientNrptRule Get-DnsClientServerAddress Get-DscConfiguration Get-DscConfigurationStatus Get-DscLocalConfigurationManager Get-DscResource Get-Dtc Get-DtcAdvancedHostSetting Get-DtcAdvancedSetting Get-DtcClusterDefault Get-DtcClusterTMMapping Get-DtcDefault Get-DtcLog Get-DtcNetworkSetting Get-DtcTransaction Get-DtcTransactionsStatistics Get-DtcTransactionsTraceSession Get-DtcTransactionsTraceSetting Get-EtwTraceProvider Get-EtwTraceSession Get-FileHash Get-FileIntegrity Get-FileShare Get-FileShareAccessControlEntry Get-FileStorageTier Get-InitiatorId Get-InitiatorPort Get-IscsiConnection Get-IscsiSession Get-IscsiTarget Get-IscsiTargetPortal Get-IseSnippet Get-LogProperties Get-MaskingSet Get-MMAgent Get-MpComputerStatus Get-MpPreference Get-MpThreat Get-MpThreatCatalog Get-MpThreatDetection Get-NCSIPolicyConfiguration Get-Net6to4Configuration Get-NetAdapter Get-NetAdapterAdvancedProperty Get-NetAdapterBinding Get-NetAdapterChecksumOffload Get-NetAdapterEncapsulatedPacketTaskOffload Get-NetAdapterHardwareInfo Get-NetAdapterIPsecOffload Get-NetAdapterLso Get-NetAdapterPacketDirect Get-NetAdapterPowerManagement Get-NetAdapterQos Get-NetAdapterRdma Get-NetAdapterRsc Get-NetAdapterRss Get-NetAdapterSriov Get-NetAdapterSriovVf Get-NetAdapterStatistics Get-NetAdapterVmq Get-NetAdapterVMQQueue Get-NetAdapterVPort Get-NetCompartment Get-NetConnectionProfile Get-NetDnsTransitionConfiguration Get-NetDnsTransitionMonitoring Get-NetEventNetworkAdapter Get-NetEventPacketCaptureProvider Get-NetEventProvider Get-NetEventSession Get-NetEventVFPProvider Get-NetEventVmNetworkAdapter Get-NetEventVmSwitch Get-NetEventVmSwitchProvider Get-NetEventWFPCaptureProvider Get-NetFirewallAddressFilter Get-NetFirewallApplicationFilter Get-NetFirewallInterfaceFilter Get-NetFirewallInterfaceTypeFilter Get-NetFirewallPortFilter Get-NetFirewallProfile Get-NetFirewallRule Get-NetFirewallSecurityFilter Get-NetFirewallServiceFilter Get-NetFirewallSetting Get-NetIPAddress Get-NetIPConfiguration Get-NetIPHttpsConfiguration Get-NetIPHttpsState Get-NetIPInterface Get-NetIPsecDospSetting Get-NetIPsecMainModeCryptoSet Get-NetIPsecMainModeRule Get-NetIPsecMainModeSA Get-NetIPsecPhase1AuthSet Get-NetIPsecPhase2AuthSet Get-NetIPsecQuickModeCryptoSet Get-NetIPsecQuickModeSA Get-NetIPsecRule Get-NetIPv4Protocol Get-NetIPv6Protocol Get-NetIsatapConfiguration Get-NetLbfoTeam Get-NetLbfoTeamMember Get-NetLbfoTeamNic Get-NetNat Get-NetNatExternalAddress Get-NetNatGlobal Get-NetNatSession Get-NetNatStaticMapping Get-NetNatTransitionConfiguration Get-NetNatTransitionMonitoring Get-NetNeighbor Get-NetOffloadGlobalSetting Get-NetPrefixPolicy Get-NetQosPolicy Get-NetRoute Get-NetSwitchTeam Get-NetSwitchTeamMember Get-NetTCPConnection Get-NetTCPSetting Get-NetTeredoConfiguration Get-NetTeredoState Get-NetTransportFilter Get-NetUDPEndpoint Get-NetUDPSetting Get-NetworkSwitchEthernetPort Get-NetworkSwitchFeature Get-NetworkSwitchGlobalData Get-NetworkSwitchVlan Get-NfsClientConfiguration Get-NfsClientgroup Get-NfsClientLock Get-NfsMappingStore Get-NfsMountedClient Get-NfsNetgroupStore Get-NfsOpenFile Get-NfsServerConfiguration Get-NfsSession Get-NfsShare Get-NfsSharePermission Get-NfsStatistics Get-OdbcDriver Get-OdbcDsn Get-OdbcPerfCounter Get-OffloadDataTransferSetting Get-Partition Get-PartitionSupportedSize Get-PcsvDevice Get-PcsvDeviceLog Get-PhysicalDisk Get-PhysicalDiskStorageNodeView Get-PhysicalExtent Get-PhysicalExtentAssociation Get-PlatformIdentifier Get-PnpDevice Get-PnpDeviceProperty Get-PrintConfiguration Get-Printer Get-PrinterDriver Get-PrinterPort Get-PrinterProperty Get-PrintJob Get-RDAvailableApp Get-RDCertificate Get-RDConnectionBrokerHighAvailability Get-RDDeploymentGatewayConfiguration Get-RDFileTypeAssociation Get-RDLicenseConfiguration Get-RDPersonalSessionDesktopAssignment Get-RDPersonalVirtualDesktopAssignment Get-RDPersonalVirtualDesktopPatchSchedule Get-RDRemoteApp Get-RDRemoteDesktop Get-RDServer Get-RDSessionCollection Get-RDSessionCollectionConfiguration Get-RDSessionHost Get-RDUserSession Get-RDVirtualDesktop Get-RDVirtualDesktopCollection Get-RDVirtualDesktopCollectionConfiguration Get-RDVirtualDesktopCollectionJobStatus Get-RDVirtualDesktopConcurrency Get-RDVirtualDesktopIdleCount Get-RDVirtualDesktopTemplateExportPath Get-RDWorkspace Get-ResiliencySetting Get-ScheduledTask Get-ScheduledTaskInfo Get-SilComputer Get-SilComputerIdentity Get-SilData Get-SilLogging Get-SilSoftware Get-SilUalAccess Get-SilWindowsUpdate Get-SmbBandWidthLimit Get-SmbClientConfiguration Get-SmbClientNetworkInterface Get-SmbConnection Get-SmbDelegation Get-SmbMapping Get-SmbMultichannelConnection Get-SmbMultichannelConstraint Get-SmbOpenFile Get-SmbServerConfiguration Get-SmbServerNetworkInterface Get-SmbSession Get-SmbShare Get-SmbShareAccess Get-SmbWitnessClient Get-SMCounterSample Get-SMPerformanceCollector Get-SMServerBpaResult Get-SMServerClusterName Get-SMServerEvent Get-SMServerFeature Get-SMServerInventory Get-SMServerService Get-StartApps Get-StorageAdvancedProperty Get-StorageDiagnosticInfo Get-StorageEnclosure Get-StorageEnclosureStorageNodeView Get-StorageEnclosureVendorData Get-StorageFaultDomain Get-StorageFileServer Get-StorageFirmwareInformation Get-StorageHealthAction Get-StorageHealthReport Get-StorageHealthSetting Get-StorageJob Get-StorageNode Get-StoragePool Get-StorageProvider Get-StorageReliabilityCounter Get-StorageSetting Get-StorageSubSystem Get-StorageTier Get-StorageTierSupportedSize Get-SupportedClusterSizes Get-SupportedFileSystems Get-TargetPort Get-TargetPortal Get-Ual Get-UalDailyAccess Get-UalDailyDeviceAccess Get-UalDailyUserAccess Get-UalDeviceAccess Get-UalDns Get-UalHyperV Get-UalOverview Get-UalServerDevice Get-UalServerUser Get-UalSystemId Get-UalUserAccess Get-VirtualDisk Get-VirtualDiskSupportedSize Get-Volume Get-VolumeCorruptionCount Get-VolumeScrubPolicy Get-VpnConnection Get-VpnConnectionTrigger Get-WdacBidTrace Get-WindowsFeature Get-WindowsUpdateLog Grant-FileShareAccess Grant-NfsSharePermission Grant-RDOUAccess Grant-SmbShareAccess Hide-VirtualDisk Import-BCCachePackage Import-BCSecretKey Import-IscsiTargetServerConfiguration Import-IseSnippet Import-PowerShellDataFile Import-RDPersonalSessionDesktopAssignment Import-RDPersonalVirtualDesktopAssignment Initialize-Disk Install-Dtc Install-WindowsFeature Invoke-AsWorkflow Invoke-RDUserLogoff Mount-DiskImage Move-RDVirtualDesktop Move-SmbWitnessClient New-AutologgerConfig New-DAEntryPointTableItem New-DscChecksum New-EapConfiguration New-EtwTraceSession New-FileShare New-Guid New-IscsiTargetPortal New-IseSnippet New-MaskingSet New-NetAdapterAdvancedProperty New-NetEventSession New-NetFirewallRule New-NetIPAddress New-NetIPHttpsConfiguration New-NetIPsecDospSetting New-NetIPsecMainModeCryptoSet New-NetIPsecMainModeRule New-NetIPsecPhase1AuthSet New-NetIPsecPhase2AuthSet New-NetIPsecQuickModeCryptoSet New-NetIPsecRule New-NetLbfoTeam New-NetNat New-NetNatTransitionConfiguration New-NetNeighbor New-NetQosPolicy New-NetRoute New-NetSwitchTeam New-NetTransportFilter New-NetworkSwitchVlan New-NfsClientgroup New-NfsShare New-Partition New-PSWorkflowSession New-RDCertificate New-RDPersonalVirtualDesktopPatchSchedule New-RDRemoteApp New-RDSessionCollection New-RDSessionDeployment New-RDVirtualDesktopCollection New-RDVirtualDesktopDeployment New-ScheduledTask New-ScheduledTaskAction New-ScheduledTaskPrincipal New-ScheduledTaskSettingsSet New-ScheduledTaskTrigger New-SmbMapping New-SmbMultichannelConstraint New-SmbShare New-StorageFileServer New-StoragePool New-StorageSubsystemVirtualDisk New-StorageTier New-TemporaryFile New-VirtualDisk New-VirtualDiskClone New-VirtualDiskSnapshot New-Volume New-VpnServerAddress Open-NetGPO Optimize-StoragePool Optimize-Volume Publish-BCFileContent Publish-BCWebContent Publish-SilData Read-PrinterNfcTag Register-ClusteredScheduledTask Register-DnsClient Register-IscsiSession Register-ScheduledTask Register-StorageSubsystem Remove-AutologgerConfig Remove-BCDataCacheExtension Remove-DAEntryPointTableItem Remove-DnsClientNrptRule Remove-DscConfigurationDocument Remove-DtcClusterTMMapping Remove-EtwTraceProvider Remove-EtwTraceSession Remove-FileShare Remove-InitiatorId Remove-InitiatorIdFromMaskingSet Remove-IscsiTargetPortal Remove-MaskingSet Remove-MpPreference Remove-MpThreat Remove-NetAdapterAdvancedProperty Remove-NetEventNetworkAdapter Remove-NetEventPacketCaptureProvider Remove-NetEventProvider Remove-NetEventSession Remove-NetEventVFPProvider Remove-NetEventVmNetworkAdapter Remove-NetEventVmSwitch Remove-NetEventVmSwitchProvider Remove-NetEventWFPCaptureProvider Remove-NetFirewallRule Remove-NetIPAddress Remove-NetIPHttpsCertBinding Remove-NetIPHttpsConfiguration Remove-NetIPsecDospSetting Remove-NetIPsecMainModeCryptoSet Remove-NetIPsecMainModeRule Remove-NetIPsecMainModeSA Remove-NetIPsecPhase1AuthSet Remove-NetIPsecPhase2AuthSet Remove-NetIPsecQuickModeCryptoSet Remove-NetIPsecQuickModeSA Remove-NetIPsecRule Remove-NetLbfoTeam Remove-NetLbfoTeamMember Remove-NetLbfoTeamNic Remove-NetNat Remove-NetNatExternalAddress Remove-NetNatStaticMapping Remove-NetNatTransitionConfiguration Remove-NetNeighbor Remove-NetQosPolicy Remove-NetRoute Remove-NetSwitchTeam Remove-NetSwitchTeamMember Remove-NetTransportFilter Remove-NetworkSwitchEthernetPortIPAddress Remove-NetworkSwitchVlan Remove-NfsClientgroup Remove-NfsShare Remove-OdbcDsn Remove-Partition Remove-PartitionAccessPath Remove-PhysicalDisk Remove-Printer Remove-PrinterDriver Remove-PrinterPort Remove-PrintJob Remove-RDDatabaseConnectionString Remove-RDPersonalSessionDesktopAssignment Remove-RDPersonalVirtualDesktopAssignment Remove-RDPersonalVirtualDesktopPatchSchedule Remove-RDRemoteApp Remove-RDServer Remove-RDSessionCollection Remove-RDSessionHost Remove-RDVirtualDesktopCollection Remove-RDVirtualDesktopFromCollection Remove-SmbBandwidthLimit Remove-SmbMapping Remove-SmbMultichannelConstraint Remove-SmbShare Remove-SMServerPerformanceLog Remove-StorageFileServer Remove-StorageHealthSetting Remove-StoragePool Remove-StorageTier Remove-TargetPortFromMaskingSet Remove-VirtualDisk Remove-VirtualDiskFromMaskingSet Remove-VpnConnection Remove-VpnConnectionRoute Remove-VpnConnectionTriggerApplication Remove-VpnConnectionTriggerDnsConfiguration Remove-VpnConnectionTriggerTrustedNetwork Rename-DAEntryPointTableItem Rename-MaskingSet Rename-NetAdapter Rename-NetFirewallRule Rename-NetIPHttpsConfiguration Rename-NetIPsecMainModeCryptoSet Rename-NetIPsecMainModeRule Rename-NetIPsecPhase1AuthSet Rename-NetIPsecPhase2AuthSet Rename-NetIPsecQuickModeCryptoSet Rename-NetIPsecRule Rename-NetLbfoTeam Rename-NetSwitchTeam Rename-NfsClientgroup Rename-Printer Repair-FileIntegrity Repair-VirtualDisk Repair-Volume Reset-BC Reset-DAClientExperienceConfiguration Reset-DAEntryPointTableItem Reset-DtcLog Reset-NCSIPolicyConfiguration Reset-Net6to4Configuration Reset-NetAdapterAdvancedProperty Reset-NetDnsTransitionConfiguration Reset-NetIPHttpsConfiguration Reset-NetIsatapConfiguration Reset-NetTeredoConfiguration Reset-NfsStatistics Reset-PhysicalDisk Reset-StorageReliabilityCounter Resize-Partition Resize-StorageTier Resize-VirtualDisk Resolve-NfsMappedIdentity Restart-NetAdapter Restart-PcsvDevice Restart-PrintJob Restore-DscConfiguration Restore-NetworkSwitchConfiguration Resume-PrintJob Revoke-FileShareAccess Revoke-NfsClientLock Revoke-NfsMountedClient Revoke-NfsOpenFile Revoke-NfsSharePermission Revoke-SmbShareAccess Save-NetGPO Save-NetworkSwitchConfiguration Send-EtwTraceSession Send-RDUserMessage Set-AssignedAccess Set-AutologgerConfig Set-BCAuthentication Set-BCCache Set-BCDataCacheEntryMaxAge Set-BCMinSMBLatency Set-BCSecretKey Set-ClusteredScheduledTask Set-DAClientExperienceConfiguration Set-DAEntryPointTableItem Set-Disk Set-DisplayResolution Set-DnsClient Set-DnsClientGlobalSetting Set-DnsClientNrptGlobal Set-DnsClientNrptRule Set-DnsClientServerAddress Set-DtcAdvancedHostSetting Set-DtcAdvancedSetting Set-DtcClusterDefault Set-DtcClusterTMMapping Set-DtcDefault Set-DtcLog Set-DtcNetworkSetting Set-DtcTransaction Set-DtcTransactionsTraceSession Set-DtcTransactionsTraceSetting Set-EtwTraceProvider Set-EtwTraceSession Set-FileIntegrity Set-FileShare Set-FileStorageTier Set-InitiatorPort Set-IscsiChapSecret Set-LogProperties Set-MMAgent Set-MpPreference Set-NCSIPolicyConfiguration Set-Net6to4Configuration Set-NetAdapter Set-NetAdapterAdvancedProperty Set-NetAdapterBinding Set-NetAdapterChecksumOffload Set-NetAdapterEncapsulatedPacketTaskOffload Set-NetAdapterIPsecOffload Set-NetAdapterLso Set-NetAdapterPacketDirect Set-NetAdapterPowerManagement Set-NetAdapterQos Set-NetAdapterRdma Set-NetAdapterRsc Set-NetAdapterRss Set-NetAdapterSriov Set-NetAdapterVmq Set-NetConnectionProfile Set-NetDnsTransitionConfiguration Set-NetEventPacketCaptureProvider Set-NetEventProvider Set-NetEventSession Set-NetEventVFPProvider Set-NetEventVmSwitchProvider Set-NetEventWFPCaptureProvider Set-NetFirewallAddressFilter Set-NetFirewallApplicationFilter Set-NetFirewallInterfaceFilter Set-NetFirewallInterfaceTypeFilter Set-NetFirewallPortFilter Set-NetFirewallProfile Set-NetFirewallRule Set-NetFirewallSecurityFilter Set-NetFirewallServiceFilter Set-NetFirewallSetting Set-NetIPAddress Set-NetIPHttpsConfiguration Set-NetIPInterface Set-NetIPsecDospSetting Set-NetIPsecMainModeCryptoSet Set-NetIPsecMainModeRule Set-NetIPsecPhase1AuthSet Set-NetIPsecPhase2AuthSet Set-NetIPsecQuickModeCryptoSet Set-NetIPsecRule Set-NetIPv4Protocol Set-NetIPv6Protocol Set-NetIsatapConfiguration Set-NetLbfoTeam Set-NetLbfoTeamMember Set-NetLbfoTeamNic Set-NetNat Set-NetNatGlobal Set-NetNatTransitionConfiguration Set-NetNeighbor Set-NetOffloadGlobalSetting Set-NetQosPolicy Set-NetRoute Set-NetTCPSetting Set-NetTeredoConfiguration Set-NetUDPSetting Set-NetworkSwitchEthernetPortIPAddress Set-NetworkSwitchPortMode Set-NetworkSwitchPortProperty Set-NetworkSwitchVlanProperty Set-NfsClientConfiguration Set-NfsClientgroup Set-NfsMappingStore Set-NfsNetgroupStore Set-NfsServerConfiguration Set-NfsShare Set-OdbcDriver Set-OdbcDsn Set-Partition Set-PcsvDeviceBootConfiguration Set-PcsvDeviceNetworkConfiguration Set-PcsvDeviceUserPassword Set-PhysicalDisk Set-PrintConfiguration Set-Printer Set-PrinterProperty Set-RDActiveManagementServer Set-RDCertificate Set-RDClientAccessName Set-RDConnectionBrokerHighAvailability Set-RDDatabaseConnectionString Set-RDDeploymentGatewayConfiguration Set-RDFileTypeAssociation Set-RDLicenseConfiguration Set-RDPersonalSessionDesktopAssignment Set-RDPersonalVirtualDesktopAssignment Set-RDPersonalVirtualDesktopPatchSchedule Set-RDRemoteApp Set-RDRemoteDesktop Set-RDSessionCollectionConfiguration Set-RDSessionHost Set-RDVirtualDesktopCollectionConfiguration Set-RDVirtualDesktopConcurrency Set-RDVirtualDesktopIdleCount Set-RDVirtualDesktopTemplateExportPath Set-RDWorkspace Set-ResiliencySetting Set-ScheduledTask Set-SilLogging Set-SmbBandwidthLimit Set-SmbClientConfiguration Set-SmbPathAcl Set-SmbServerConfiguration Set-SmbShare Set-StorageFileServer Set-StorageHealthSetting Set-StoragePool Set-StorageProvider Set-StorageSetting Set-StorageSubSystem Set-StorageTier Set-VirtualDisk Set-Volume Set-VolumeScrubPolicy Set-VpnConnection Set-VpnConnectionIPsecConfiguration Set-VpnConnectionProxy Set-VpnConnectionTriggerDnsConfiguration Set-VpnConnectionTriggerTrustedNetwork Show-NetFirewallRule Show-NetIPsecRule Show-VirtualDisk Start-AppBackgroundTask Start-AppvVirtualProcess Start-AutologgerConfig Start-Dtc Start-DtcTransactionsTraceSession Start-MpScan Start-MpWDOScan Start-NetEventSession Start-PcsvDevice Start-ScheduledTask Start-SilLogging Start-SMPerformanceCollector Start-StorageDiagnosticLog Start-Trace Stop-DscConfiguration Stop-Dtc Stop-DtcTransactionsTraceSession Stop-NetEventSession Stop-PcsvDevice Stop-RDVirtualDesktopCollectionJob Stop-ScheduledTask Stop-SilLogging Stop-SMPerformanceCollector Stop-StorageDiagnosticLog Stop-StorageJob Stop-Trace Suspend-PrintJob Sync-NetIPsecRule Test-Dtc Test-NetConnection Test-NfsMappingStore Test-RDOUAccess Test-RDVirtualDesktopADMachineAccountReuse Unblock-FileShareAccess Unblock-SmbShareAccess Uninstall-Dtc Uninstall-WindowsFeature Unregister-AppBackgroundTask Unregister-ClusteredScheduledTask Unregister-IscsiSession Unregister-ScheduledTask Unregister-StorageSubsystem Update-Disk Update-DscConfiguration Update-HostStorageCache Update-IscsiTarget Update-IscsiTargetPortal Update-MpSignature Update-NetIPsecRule Update-RDVirtualDesktopCollection Update-SmbMultichannelConnection Update-StorageFirmware Update-StoragePool Update-StorageProviderCache Write-DtcTransactionsTraceSession Write-PrinterNfcTag Write-VolumeCache Add-ADCentralAccessPolicyMember Add-ADComputerServiceAccount Add-ADDomainControllerPasswordReplicationPolicy Add-ADFineGrainedPasswordPolicySubject Add-ADGroupMember Add-ADPrincipalGroupMembership Add-ADResourcePropertyListMember Add-AppvClientConnectionGroup Add-AppvClientPackage Add-AppvPublishingServer Add-AppxPackage Add-AppxProvisionedPackage Add-AppxVolume Add-BitsFile Add-CertificateEnrollmentPolicyServer Add-ClusteriSCSITargetServerRole Add-Computer Add-Content Add-IscsiVirtualDiskTargetMapping Add-JobTrigger Add-KdsRootKey Add-LocalGroupMember Add-Member Add-SignerRule Add-Type Add-WebConfiguration Add-WebConfigurationLock Add-WebConfigurationProperty Add-WindowsCapability Add-WindowsDriver Add-WindowsImage Add-WindowsPackage Backup-AuditPolicy Backup-SecurityPolicy Backup-WebConfiguration Checkpoint-Computer Checkpoint-IscsiVirtualDisk Clear-ADAccountExpiration Clear-ADClaimTransformLink Clear-Content Clear-EventLog Clear-IISCentralCertProvider Clear-IISConfigCollection Clear-Item Clear-ItemProperty Clear-KdsCache Clear-RecycleBin Clear-Tpm Clear-UevAppxPackage Clear-UevConfiguration Clear-Variable Clear-WebCentralCertProvider Clear-WebConfiguration Clear-WebRequestTracingSetting Clear-WebRequestTracingSettings Clear-WindowsCorruptMountPoint Compare-Object Complete-BitsTransfer Complete-DtcDiagnosticTransaction Complete-Transaction Confirm-SecureBootUEFI Connect-WSMan ConvertFrom-CIPolicy ConvertFrom-Csv ConvertFrom-Json ConvertFrom-SecureString ConvertFrom-String ConvertFrom-StringData Convert-IscsiVirtualDisk Convert-Path Convert-String ConvertTo-Csv ConvertTo-Html ConvertTo-Json ConvertTo-SecureString ConvertTo-TpmOwnerAuth ConvertTo-WebApplication ConvertTo-Xml Copy-Item Copy-ItemProperty Debug-Process Debug-Runspace Disable-ADAccount Disable-ADOptionalFeature Disable-AppBackgroundTaskDiagnosticLog Disable-Appv Disable-AppvClientConnectionGroup Disable-ComputerRestore Disable-IISCentralCertProvider Disable-IISSharedConfig Disable-JobTrigger Disable-LocalUser Disable-PSBreakpoint Disable-RunspaceDebug Disable-ScheduledJob Disable-TlsCipherSuite Disable-TlsEccCurve Disable-TlsSessionTicketKey Disable-TpmAutoProvisioning Disable-Uev Disable-UevAppxPackage Disable-UevTemplate Disable-WebCentralCertProvider Disable-WebGlobalModule Disable-WebRequestTracing Disable-WindowsErrorReporting Disable-WindowsOptionalFeature Disable-WSManCredSSP Disconnect-WSMan Dismount-AppxVolume Dismount-IscsiVirtualDiskSnapshot Dismount-WindowsImage Edit-CIPolicyRule Enable-ADAccount Enable-ADOptionalFeature Enable-AppBackgroundTaskDiagnosticLog Enable-Appv Enable-AppvClientConnectionGroup Enable-ComputerRestore Enable-IISCentralCertProvider Enable-IISSharedConfig Enable-JobTrigger Enable-LocalUser Enable-PSBreakpoint Enable-RunspaceDebug Enable-ScheduledJob Enable-TlsCipherSuite Enable-TlsEccCurve Enable-TlsSessionTicketKey Enable-TpmAutoProvisioning Enable-Uev Enable-UevAppxPackage Enable-UevTemplate Enable-WebCentralCertProvider Enable-WebGlobalModule Enable-WebRequestTracing Enable-WindowsErrorReporting Enable-WindowsOptionalFeature Enable-WSManCredSSP Expand-WindowsCustomDataImage Expand-WindowsImage Export-Alias Export-BinaryMiLog Export-Certificate Export-Clixml Export-Counter Export-Csv Export-FormatData Export-IISConfiguration Export-IscsiVirtualDiskSnapshot Export-PfxCertificate Export-PSSession Export-StartLayout Export-TlsSessionTicketKey Export-UevConfiguration Export-UevPackage Export-WindowsDriver Export-WindowsImage Format-Custom Format-List Format-SecureBootUEFI Format-Table Format-Wide Get-Acl Get-ADAccountAuthorizationGroup Get-ADAccountResultantPasswordReplicationPolicy Get-ADAuthenticationPolicy Get-ADAuthenticationPolicySilo Get-ADCentralAccessPolicy Get-ADCentralAccessRule Get-ADClaimTransformPolicy Get-ADClaimType Get-ADComputer Get-ADComputerServiceAccount Get-ADDCCloningExcludedApplicationList Get-ADDefaultDomainPasswordPolicy Get-ADDomain Get-ADDomainController Get-ADDomainControllerPasswordReplicationPolicy Get-ADDomainControllerPasswordReplicationPolicyUsage Get-ADFineGrainedPasswordPolicy Get-ADFineGrainedPasswordPolicySubject Get-ADForest Get-ADGroup Get-ADGroupMember Get-ADObject Get-ADOptionalFeature Get-ADOrganizationalUnit Get-ADPrincipalGroupMembership Get-ADReplicationAttributeMetadata Get-ADReplicationConnection Get-ADReplicationFailure Get-ADReplicationPartnerMetadata Get-ADReplicationQueueOperation Get-ADReplicationSite Get-ADReplicationSiteLink Get-ADReplicationSiteLinkBridge Get-ADReplicationSubnet Get-ADReplicationUpToDatenessVectorTable Get-ADResourceProperty Get-ADResourcePropertyList Get-ADResourcePropertyValueType Get-ADRootDSE Get-ADServiceAccount Get-ADTrust Get-ADUser Get-ADUserResultantPasswordPolicy Get-Alias Get-AppLockerFileInformation Get-AppLockerPolicy Get-AppvClientApplication Get-AppvClientConfiguration Get-AppvClientConnectionGroup Get-AppvClientMode Get-AppvClientPackage Get-AppvPublishingServer Get-AppvStatus Get-AppxDefaultVolume Get-AppxPackage Get-AppxPackageManifest Get-AppxProvisionedPackage Get-AppxVolume Get-AuthenticodeSignature Get-BitsTransfer Get-BpaModel Get-BpaResult Get-Certificate Get-CertificateAutoEnrollmentPolicy Get-CertificateEnrollmentPolicyServer Get-CertificateNotificationTask Get-ChildItem Get-CimAssociatedInstance Get-CimClass Get-CimInstance Get-CimSession Get-CIPolicy Get-CIPolicyIdInfo Get-CIPolicyInfo Get-Clipboard Get-CmsMessage Get-ComputerInfo Get-ComputerRestorePoint Get-Content Get-ControlPanelItem Get-Counter Get-Credential Get-Culture Get-DAPolicyChange Get-Date Get-Event Get-EventLog Get-EventSubscriber Get-ExecutionPolicy Get-FormatData Get-Host Get-HotFix Get-IISAppPool Get-IISCentralCertProvider Get-IISConfigAttributeValue Get-IISConfigCollection Get-IISConfigCollectionElement Get-IISConfigElement Get-IISConfigSection Get-IISServerManager Get-IISSharedConfig Get-IISSite Get-IscsiServerTarget Get-IscsiTargetServerSetting Get-IscsiVirtualDisk Get-IscsiVirtualDiskSnapshot Get-Item Get-ItemProperty Get-ItemPropertyValue Get-JobTrigger Get-KdsConfiguration Get-KdsRootKey Get-LocalGroup Get-LocalGroupMember Get-LocalUser Get-Location Get-Member Get-NfsMappedIdentity Get-NfsNetgroup Get-PfxCertificate Get-PfxData Get-Process Get-PSBreakpoint Get-PSCallStack Get-PSDrive Get-PSProvider Get-Random Get-Runspace Get-RunspaceDebug Get-ScheduledJob Get-ScheduledJobOption Get-SecureBootPolicy Get-SecureBootUEFI Get-Service Get-SystemDriver Get-TimeZone Get-TlsCipherSuite Get-TlsEccCurve Get-Tpm Get-TpmEndorsementKeyInfo Get-TpmSupportedFeature Get-TraceSource Get-Transaction Get-TroubleshootingPack Get-TypeData Get-UevAppxPackage Get-UevConfiguration Get-UevStatus Get-UevTemplate Get-UevTemplateProgram Get-UICulture Get-Unique Get-Variable Get-WebAppDomain Get-WebApplication Get-WebAppPoolState Get-WebBinding Get-WebCentralCertProvider Get-WebConfigFile Get-WebConfiguration Get-WebConfigurationBackup Get-WebConfigurationLocation Get-WebConfigurationLock Get-WebConfigurationProperty Get-WebFilePath Get-WebGlobalModule Get-WebHandler Get-WebItemState Get-WebManagedModule Get-WebRequest Get-Website Get-WebsiteState Get-WebURL Get-WebVirtualDirectory Get-WheaMemoryPolicy Get-WIMBootEntry Get-WinAcceptLanguageFromLanguageListOptOut Get-WinCultureFromLanguageListOptOut Get-WinDefaultInputMethodOverride Get-WindowsCapability Get-WindowsDeveloperLicense Get-WindowsDriver Get-WindowsEdition Get-WindowsErrorReporting Get-WindowsImage Get-WindowsImageContent Get-WindowsOptionalFeature Get-WindowsPackage Get-WindowsSearchSetting Get-WinEvent Get-WinHomeLocation Get-WinLanguageBarOption Get-WinSystemLocale Get-WinUILanguageOverride Get-WinUserLanguageList Get-WmiObject Get-WSManCredSSP Get-WSManInstance Grant-ADAuthenticationPolicySiloAccess Group-Object Import-Alias Import-BinaryMiLog Import-Certificate Import-Clixml Import-Counter Import-Csv Import-IscsiVirtualDisk Import-LocalizedData Import-PfxCertificate Import-PSSession Import-StartLayout Import-TpmOwnerAuth Import-UevConfiguration Initialize-Tpm Install-ADServiceAccount Install-NfsMappingStore Invoke-BpaModel Invoke-CimMethod Invoke-CommandInDesktopPackage Invoke-DscResource Invoke-Expression Invoke-Item Invoke-RestMethod Invoke-TroubleshootingPack Invoke-WebRequest Invoke-WmiMethod Invoke-WSManAction Join-DtcDiagnosticResourceManager Join-Path Limit-EventLog Measure-Command Measure-Object Merge-CIPolicy Mount-AppvClientConnectionGroup Mount-AppvClientPackage Mount-AppxVolume Mount-IscsiVirtualDiskSnapshot Mount-WindowsImage Move-ADDirectoryServer Move-ADDirectoryServerOperationMasterRole Move-ADObject Move-AppxPackage Move-Item Move-ItemProperty New-ADAuthenticationPolicy New-ADAuthenticationPolicySilo New-ADCentralAccessPolicy New-ADCentralAccessRule New-ADClaimTransformPolicy New-ADClaimType New-ADComputer New-ADDCCloneConfigFile New-ADFineGrainedPasswordPolicy New-ADGroup New-ADObject New-ADOrganizationalUnit New-ADReplicationSite New-ADReplicationSiteLink New-ADReplicationSiteLinkBridge New-ADReplicationSubnet New-ADResourceProperty New-ADResourcePropertyList New-ADServiceAccount New-ADUser New-Alias New-AppLockerPolicy New-CertificateNotificationTask New-CimInstance New-CimSession New-CimSessionOption New-CIPolicy New-CIPolicyRule New-DtcDiagnosticTransaction New-Event New-EventLog New-FileCatalog New-IISConfigCollectionElement New-IISSite New-IscsiServerTarget New-IscsiVirtualDisk New-Item New-ItemProperty New-JobTrigger New-LocalGroup New-LocalUser New-NetIPsecAuthProposal New-NetIPsecMainModeCryptoProposal New-NetIPsecQuickModeCryptoProposal New-NfsMappedIdentity New-NfsNetgroup New-Object New-PSDrive New-PSWorkflowExecutionOption New-ScheduledJobOption New-SelfSignedCertificate New-Service New-TimeSpan New-TlsSessionTicketKey New-Variable New-WebApplication New-WebAppPool New-WebBinding New-WebFtpSite New-WebGlobalModule New-WebHandler New-WebManagedModule New-WebServiceProxy New-Website New-WebVirtualDirectory New-WindowsCustomImage New-WindowsImage New-WinEvent New-WinUserLanguageList New-WSManInstance New-WSManSessionOption Optimize-WindowsImage Out-File Out-GridView Out-Printer Out-String Pop-Location Protect-CmsMessage Publish-AppvClientPackage Publish-DscConfiguration Push-Location Read-Host Receive-DtcDiagnosticTransaction Register-CimIndicationEvent Register-EngineEvent Register-ObjectEvent Register-ScheduledJob Register-UevTemplate Register-WmiEvent Remove-ADAuthenticationPolicy Remove-ADAuthenticationPolicySilo Remove-ADCentralAccessPolicy Remove-ADCentralAccessPolicyMember Remove-ADCentralAccessRule Remove-ADClaimTransformPolicy Remove-ADClaimType Remove-ADComputer Remove-ADComputerServiceAccount Remove-ADDomainControllerPasswordReplicationPolicy Remove-ADFineGrainedPasswordPolicy Remove-ADFineGrainedPasswordPolicySubject Remove-ADGroup Remove-ADGroupMember Remove-ADObject Remove-ADOrganizationalUnit Remove-ADPrincipalGroupMembership Remove-ADReplicationSite Remove-ADReplicationSiteLink Remove-ADReplicationSiteLinkBridge Remove-ADReplicationSubnet Remove-ADResourceProperty Remove-ADResourcePropertyList Remove-ADResourcePropertyListMember Remove-ADServiceAccount Remove-ADUser Remove-AppvClientConnectionGroup Remove-AppvClientPackage Remove-AppvPublishingServer Remove-AppxPackage Remove-AppxProvisionedPackage Remove-AppxVolume Remove-BitsTransfer Remove-CertificateEnrollmentPolicyServer Remove-CertificateNotificationTask Remove-CimInstance Remove-CimSession Remove-CIPolicyRule Remove-Computer Remove-Event Remove-EventLog Remove-IISConfigAttribute Remove-IISConfigCollectionElement Remove-IISConfigElement Remove-IISSite Remove-IscsiServerTarget Remove-IscsiVirtualDisk Remove-IscsiVirtualDiskSnapshot Remove-IscsiVirtualDiskTargetMapping Remove-Item Remove-ItemProperty Remove-JobTrigger Remove-LocalGroup Remove-LocalGroupMember Remove-LocalUser Remove-NfsMappedIdentity Remove-NfsNetgroup Remove-PSBreakpoint Remove-PSDrive Remove-TypeData Remove-Variable Remove-WebApplication Remove-WebAppPool Remove-WebBinding Remove-WebConfigurationBackup Remove-WebConfigurationLocation Remove-WebConfigurationLock Remove-WebConfigurationProperty Remove-WebGlobalModule Remove-WebHandler Remove-WebManagedModule Remove-Website Remove-WebVirtualDirectory Remove-WindowsCapability Remove-WindowsDriver Remove-WindowsImage Remove-WindowsPackage Remove-WmiObject Remove-WSManInstance Rename-ADObject Rename-Computer Rename-Item Rename-ItemProperty Rename-LocalGroup Rename-LocalUser Rename-WebConfigurationLocation Repair-AppvClientConnectionGroup Repair-AppvClientPackage Repair-UevTemplateIndex Repair-WindowsImage Reset-ADServiceAccountPassword Reset-ComputerMachinePassword Reset-IISServerManager Resize-IscsiVirtualDisk Resolve-DnsName Resolve-Path Restart-Computer Restart-Service Restart-WebAppPool Restart-WebItem Restore-ADObject Restore-AuditPolicy Restore-Computer Restore-IscsiVirtualDisk Restore-SecurityPolicy Restore-UevBackup Restore-UevUserSetting Restore-WebConfiguration Resume-BitsTransfer Resume-Service Revoke-ADAuthenticationPolicySiloAccess Save-WindowsImage Search-ADAccount Select-Object Select-String Select-WebConfiguration Select-Xml Send-AppvClientReport Send-DtcDiagnosticTransaction Send-MailMessage Set-Acl Set-ADAccountAuthenticationPolicySilo Set-ADAccountControl Set-ADAccountExpiration Set-ADAccountPassword Set-ADAuthenticationPolicy Set-ADAuthenticationPolicySilo Set-ADCentralAccessPolicy Set-ADCentralAccessRule Set-ADClaimTransformLink Set-ADClaimTransformPolicy Set-ADClaimType Set-ADComputer Set-ADDefaultDomainPasswordPolicy Set-ADDomain Set-ADDomainMode Set-ADFineGrainedPasswordPolicy Set-ADForest Set-ADForestMode Set-ADGroup Set-ADObject Set-ADOrganizationalUnit Set-ADReplicationConnection Set-ADReplicationSite Set-ADReplicationSiteLink Set-ADReplicationSiteLinkBridge Set-ADReplicationSubnet Set-ADResourceProperty Set-ADResourcePropertyList Set-ADServiceAccount Set-ADUser Set-Alias Set-AppBackgroundTaskResourcePolicy Set-AppLockerPolicy Set-AppvClientConfiguration Set-AppvClientMode Set-AppvClientPackage Set-AppvPublishingServer Set-AppxDefaultVolume Set-AppXProvisionedDataFile Set-AuthenticodeSignature Set-BitsTransfer Set-BpaResult Set-CertificateAutoEnrollmentPolicy Set-CimInstance Set-CIPolicyIdInfo Set-CIPolicySetting Set-CIPolicyVersion Set-Clipboard Set-Content Set-Culture Set-Date Set-DscLocalConfigurationManager Set-ExecutionPolicy Set-HVCIOptions Set-IISCentralCertProvider Set-IISCentralCertProviderCredential Set-IISConfigAttributeValue Set-IscsiServerTarget Set-IscsiTargetServerSetting Set-IscsiVirtualDisk Set-IscsiVirtualDiskSnapshot Set-Item Set-ItemProperty Set-JobTrigger Set-KdsConfiguration Set-LocalGroup Set-LocalUser Set-Location Set-NfsMappedIdentity Set-NfsNetgroup Set-PSBreakpoint Set-RuleOption Set-ScheduledJob Set-ScheduledJobOption Set-SecureBootUEFI Set-Service Set-TimeZone Set-TpmOwnerAuth Set-TraceSource Set-UevConfiguration Set-UevTemplateProfile Set-Variable Set-WebBinding Set-WebCentralCertProvider Set-WebCentralCertProviderCredential Set-WebConfiguration Set-WebConfigurationProperty Set-WebGlobalModule Set-WebHandler Set-WebManagedModule Set-WheaMemoryPolicy Set-WinAcceptLanguageFromLanguageListOptOut Set-WinCultureFromLanguageListOptOut Set-WinDefaultInputMethodOverride Set-WindowsEdition Set-WindowsProductKey Set-WindowsSearchSetting Set-WinHomeLocation Set-WinLanguageBarOption Set-WinSystemLocale Set-WinUILanguageOverride Set-WinUserLanguageList Set-WmiInstance Set-WSManInstance Set-WSManQuickConfig Show-ADAuthenticationPolicyExpression Show-Command Show-ControlPanelItem Show-EventLog Show-WindowsDeveloperLicenseRegistration Sort-Object Split-Path Split-WindowsImage Start-BitsTransfer Start-DscConfiguration Start-DtcDiagnosticResourceManager Start-IISCommitDelay Start-IISSite Start-Process Start-Service Start-Sleep Start-Transaction Start-Transcript Start-WebAppPool Start-WebCommitDelay Start-WebItem Start-Website Stop-AppvClientConnectionGroup Stop-AppvClientPackage Stop-Computer Stop-DtcDiagnosticResourceManager Stop-IISCommitDelay Stop-IISSite Stop-IscsiVirtualDiskOperation Stop-Process Stop-Service Stop-Transcript Stop-WebAppPool Stop-WebCommitDelay Stop-WebItem Stop-Website Suspend-BitsTransfer Suspend-Service Switch-Certificate Sync-ADObject Sync-AppvPublishingServer Tee-Object Test-ADServiceAccount Test-AppLockerPolicy Test-Certificate Test-ComputerSecureChannel Test-Connection Test-DscConfiguration Test-FileCatalog Test-KdsRootKey Test-NfsMappedIdentity Test-Path Test-UevTemplate Test-WSMan Trace-Command Unblock-File Unblock-Tpm Undo-DtcDiagnosticTransaction Undo-Transaction Uninstall-ADServiceAccount Unlock-ADAccount Unprotect-CmsMessage Unpublish-AppvClientPackage Unregister-Event Unregister-ScheduledJob Unregister-UevTemplate Unregister-WindowsDeveloperLicense Update-FormatData Update-List Update-TypeData Update-UevTemplate Update-WIMBootEntry Use-Transaction Use-WindowsUnattend Wait-Debugger Wait-Event Wait-Process Write-Debug Write-Error Write-EventLog Write-Host Write-Information Write-Output Write-Progress Write-Verbose Write-Warning \% \? ac asnp cat cd chdir clc clear clhy cli clp cls clv cnsn compare copy cp cpi cpp curl cvpa dbp del diff dir dnsn ebp echo epal epcsv epsn erase etsn exsn fc fl foreach ft fw gal gbp gc gci gcm gcs gdr ghy gi gjb gl gm gmo gp gps gpv group gsn gsnp gsv gu gv gwmi h history icm iex ihy ii ipal ipcsv ipmo ipsn irm ise iwmi iwr kill lp ls man md measure mi mount move mp mv nal ndr ni nmo npssc nsn nv ogv oh popd ps pushd pwd r rbp rcjb rcsn rd rdr ren ri rjb rm rmdir rmo rni rnp rp rsn rsnp rujb rv rvpa rwmi sajb sal saps sasv sbp sc select set shcm si sl sleep sls sort sp spjb spps spsv start sujb sv swmi tee trcm type wget where wjb write ).join('|') # Override from Shell state :interp do rule /`$/, Str::Escape # line continuation rule /`./, Str::Escape rule /\$\(\(/, Keyword, :math rule /\$\(/, Keyword, :paren rule /\${#?/, Keyword, :curly rule /\$#?(\w+|.)/, Name::Variable end # Override from Shell state :double_quotes do # NB: "abc$" is literally the string abc$. # Here we prevent :interp from interpreting $" as a variable. rule /(?:\$#?)?"/, Str::Double, :pop! mixin :interp rule /[^"`$]+/, Str::Double end # Override from Shell state :data do rule /\s+/, Text rule /\$?"/, Str::Double, :double_quotes rule /\$'/, Str::Single, :ansi_string rule /'/, Str::Single, :single_quotes rule /\*/, Keyword rule /;/, Text rule /[^=\*\s{}()$"'`<]+/, Text rule /\d+(?= |\Z)/, Num rule /)m, Comment::Multiline rule /#.*$/, Comment::Single rule /\b(#{OPERATORS})\s*\b/i, Operator rule /\b(#{ATTRIBUTES})\s*\b/i, Name::Attribute rule /\b(#{KEYWORDS})\s*\b/i, Keyword rule /\b(#{KEYWORDS_TYPE})\s*\b/i, Keyword::Type rule /\bcase\b/, Keyword, :case rule /\b(#{BUILTINS})\s*\b(?!\.)/i, Name::Builtin end end end end rouge-2.2.1/lib/rouge/lexers/q.rb0000644000175000017500000001010713150713277016454 0ustar uwabamiuwabamimodule Rouge module Lexers class Q < RegexLexer title 'Q' desc 'The Q programming language (kx.com)' tag 'q' aliases 'kdb+' filenames '*.q' mimetypes 'text/x-q', 'application/x-q' identifier = /\.?[a-z][a-z0-9_.]*/i def self.keywords @keywords ||= %w[do if while select update delete exec from by] end def self.word_operators @word_operators ||= %w[ and or except inter like each cross vs sv within where in asof bin binr cor cov cut ej fby div ij insert lj ljf mavg mcount mdev mmax mmin mmu mod msum over prior peach pj scan scov setenv ss sublist uj union upsert wavg wsum xasc xbar xcol xcols xdesc xexp xgroup xkey xlog xprev xrank ] end def self.builtins @builtins ||= %w[ first enlist value type get set count string key max min sum prd last flip distinct raze neg desc differ dsave dev eval exit exp fills fkeys floor getenv group gtime hclose hcount hdel hopen hsym iasc idesc inv keys load log lsq ltime ltrim maxs md5 med meta mins next parse plist prds prev rand rank ratios read0 read1 reciprocal reverse rload rotate rsave rtrim save sdev show signum sin sqrt ssr sums svar system tables tan til trim txf ungroup var view views wj wj1 ww ] end def self.analyze_text(text) return 0 end state :root do # q allows a file to start with a shebang rule /#!(.*?)$/, Comment::Preproc, :top rule //, Text, :top end state :top do # indented lines at the top of the file are ignored by q rule /^[ \t\r]+.*$/, Comment::Special rule /\n+/, Text rule //, Text, :base end state :base do rule /\n+/m, Text rule(/^.\)/, Keyword::Declaration) # Identifiers, word operators, etc. rule /#{identifier}/ do |m| if self.class.keywords.include? m[0] token Keyword elsif self.class.word_operators.include? m[0] token Operator::Word elsif self.class.builtins.include? m[0] token Name::Builtin elsif /^\.[zQqho]\./ =~ m[0] token Name::Constant else token Name end end # White space and comments rule(%r{[ \t\r]\/.*$}, Comment::Single) rule(/[ \t\r]+/, Text::Whitespace) rule(%r{^/$.*?^\\$}m, Comment::Multiline) rule(%r{^\/[^\n]*$(\n[^\S\n]+.*$)*}, Comment::Multiline) # til EOF comment rule(/^\\$/, Comment, :bottom) rule(/^\\\\\s+/, Keyword, :bottom) # Literals ## strings rule(/"/, Str, :string) ## timespan/stamp constants rule(/(?:\d+D|\d{4}\.[01]\d\.[0123]\d[DT])(?:[012]\d:[0-5]\d(?::[0-5]\d(?:\.\d+)?)?|([012]\d)?)[zpn]?\b/, Literal::Date) ## time/minute/second constants rule(/[012]\d:[0-5]\d(?::[0-5]\d(\.\d+)?)?[uvtpn]?\b/, Literal::Date) ## date constants rule(/\d{4}\.[01]\d\.[0-3]\d[dpnzm]?\b/, Literal::Date) ## special values rule(/0[nNwW][hijefcpmdznuvt]?/, Keyword::Constant) # operators to match before numbers rule(%r{'|\/:|\\:|':|\\|\/|0:|1:|2:}, Operator) ## numbers rule(/(\d+[.]\d*|[.]\d+)(e[+-]?\d+)?[ef]?/, Num::Float) rule(/\d+e[+-]?\d+[ef]?/, Num::Float) rule(/\d+[ef]/, Num::Float) rule(/0x[0-9a-f]+/i, Num::Hex) rule(/[01]+b/, Num::Bin) rule(/[0-9]+[hij]?/, Num::Integer) ## symbols and paths rule(%r{(`:[:a-z0-9._\/]*|`(?:[a-z0-9.][:a-z0-9._]*)?)}i, Str::Symbol) rule(/(?:<=|>=|<>|::)|[?:$%&|@._#*^\-+~,!><=]:?/, Operator) rule /[{}\[\]();]/, Punctuation # commands rule(/\\.*\n/, Text) end state :string do rule(/"/, Str, :pop!) rule /\\([\\nr]|[01][0-7]{2})/, Str::Escape rule /[^\\"\n]+/, Str rule /\\/, Str # stray backslash end state :bottom do rule /.*\z/m, Comment::Multiline end end end end rouge-2.2.1/lib/rouge/lexers/conf.rb0000644000175000017500000000100713150713277017140 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Conf < RegexLexer tag 'conf' aliases 'config', 'configuration' title "Config File" desc 'A generic lexer for configuration files' filenames '*.conf', '*.config' # short and sweet state :root do rule /#.*?\n/, Comment rule /".*?"/, Str::Double rule /'.*?'/, Str::Single rule /[a-z]\w*/i, Name rule /\d+/, Num rule /[^\d\w#"']+/, Text end end end end rouge-2.2.1/lib/rouge/lexers/fsharp.rb0000644000175000017500000000711213150713277017501 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class FSharp < RegexLexer title "FSharp" desc 'F# (fsharp.net)' tag 'fsharp' filenames '*.fs', '*.fsx' mimetypes 'application/fsharp-script', 'text/x-fsharp', 'text/x-fsi' def self.keywords @keywords ||= Set.new %w( abstract and as assert base begin class default delegate do done downcast downto elif else end exception extern false finally for fun function global if in inherit inline interface internal lazy let let! match member module mutable namespace new not null of open or override private public rec return return! select static struct then to true try type upcast use use! val void when while with yield yield! sig atomic break checked component const constraint constructor continue eager event external fixed functor include method mixin object parallel process protected pure sealed tailcall trait virtual volatile ) end def self.keyopts @keyopts ||= Set.new %w( != # & && ( ) * \+ , - -. -> . .. : :: := :> ; ;; < <- = > >] >} ? ?? [ [< [> [| ] _ ` { {< | |] } ~ |> <| <> ) end def self.word_operators @word_operators ||= Set.new %w(and asr land lor lsl lxor mod or) end def self.primitives @primitives ||= Set.new %w(unit int float bool string char list array) end operator = %r([\[\];,{}_()!$%&*+./:<=>?@^|~#-]+) id = /[a-z][\w']*/i upper_id = /[A-Z][\w']*/ state :root do rule /\s+/m, Text rule /false|true|[(][)]|\[\]/, Name::Builtin::Pseudo rule /#{upper_id}(?=\s*[.])/, Name::Namespace, :dotted rule upper_id, Name::Class rule /[(][*](?![)])/, Comment, :comment rule %r(//.*?$), Comment::Single rule id do |m| match = m[0] if self.class.keywords.include? match token Keyword elsif self.class.word_operators.include? match token Operator::Word elsif self.class.primitives.include? match token Keyword::Type else token Name end end rule operator do |m| match = m[0] if self.class.keyopts.include? match token Punctuation else token Operator end end rule /-?\d[\d_]*(.[\d_]*)?(e[+-]?\d[\d_]*)/i, Num::Float rule /0x\h[\h_]*/i, Num::Hex rule /0o[0-7][0-7_]*/i, Num::Oct rule /0b[01][01_]*/i, Num::Bin rule /\d[\d_]*/, Num::Integer rule /'(?:(\\[\\"'ntbr ])|(\\[0-9]{3})|(\\x\h{2}))'/, Str::Char rule /'[.]'/, Str::Char rule /'/, Keyword rule /"/, Str::Double, :string rule /[~?]#{id}/, Name::Variable end state :comment do rule /[^(*)]+/, Comment rule(/[(][*]/) { token Comment; push } rule /[*][)]/, Comment, :pop! rule /[(*)]/, Comment end state :string do rule /[^\\"]+/, Str::Double mixin :escape_sequence rule /\\\n/, Str::Double rule /"/, Str::Double, :pop! end state :escape_sequence do rule /\\[\\"'ntbr]/, Str::Escape rule /\\\d{3}/, Str::Escape rule /\\x\h{2}/, Str::Escape end state :dotted do rule /\s+/m, Text rule /[.]/, Punctuation rule /#{upper_id}(?=\s*[.])/, Name::Namespace rule upper_id, Name::Class, :pop! rule id, Name, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/gherkin/0000755000175000017500000000000013150713277017317 5ustar uwabamiuwabamirouge-2.2.1/lib/rouge/lexers/gherkin/keywords.rb0000644000175000017500000003436413150713277021525 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # # automatically generated by `rake builtins:gherkin` module Rouge module Lexers def Gherkin.keywords @keywords ||= {}.tap do |k| k[:feature] = Set.new ["Ability", "Ahoy matey!", "Arwedd", "Aspekt", "Besigheid Behoefte", "Biznis potreba", "Business Need", "Caracteristica", "Característica", "Carauterística", "Egenskab", "Egenskap", "Eiginleiki", "Feature", "Fitur", "Fonctionnalité", "Fonksyonalite", "Funcionalidade", "Funcionalitat", "Functionalitate", "Functionaliteit", "Funcţionalitate", "Funcționalitate", "Fungsi", "Funkcia", "Funkcija", "Funkcionalitāte", "Funkcionalnost", "Funkcja", "Funksie", "Funktionalität", "Funktionalitéit", "Funzionalità", "Fīča", "Gné", "Hwaet", "Hwæt", "Jellemző", "Karakteristik", "Karakteristika", "Lastnost", "Mak", "Mogucnost", "Mogućnost", "Mozhnost", "Moznosti", "Možnosti", "OH HAI", "Omadus", "Ominaisuus", "Osobina", "Potrzeba biznesowa", "Požadavek", "Požiadavka", "Pretty much", "Qap", "Qu'meH 'ut", "Savybė", "Trajto", "Tính năng", "Vermoë", "Vlastnosť", "Właściwość", "Značilnost", "laH", "perbogh", "poQbogh malja'", "Özellik", "Özəllik", "Δυνατότητα", "Λειτουργία", "Бизнис потреба", "Могућност", "Можност", "Мөмкинлек", "Особина", "Свойство", "Функц", "Функционал", "Функционалност", "Функциональность", "Функция", "Функціонал", "Үзенчәлеклелек", "Հատկություն", "Ֆունկցիոնալություն", "תכונה", "خاصية", "خصوصیت", "صلاحیت", "وِیژگی", "کاروبار کی ضرورت", "रूप लेख", "ਖਾਸੀਅਤ", "ਨਕਸ਼ ਨੁਹਾਰ", "ਮੁਹਾਂਦਰਾ", "ક્ષમતા", "લક્ષણ", "વ્યાપાર જરૂર", "அம்சம்", "திறன்", "வணிக தேவை", "గుణము", "ಹೆಚ್ಚಳ", "ความต้องการทางธุรกิจ", "ความสามารถ", "โครงหลัก", "თვისება", "フィーチャ", "功能", "機能", "기능", "📚"] k[:element] = Set.new ["Abstract Scenario", "Abstrakt Scenario", "Achtergrond", "Aer", "Agtergrond", "Antecedentes", "Antecedents", "Atburðarás", "Awww, look mate", "B4", "Background", "Baggrund", "Bakgrund", "Bakgrunn", "Bakgrunnur", "Bối cảnh", "Casu", "Cefndir", "Cenario", "Cenario de Fundo", "Cenário", "Cenário de Fundo", "Contesto", "Context", "Contexte", "Contexto", "Cás", "Cás Achomair", "Cúlra", "Dasar", "Delineacao do Cenario", "Delineação do Cenário", "Dis is what went down", "Dyagram Senaryo", "Dyagram senaryo", "Esbozo do escenario", "Esbozu del casu", "Escenari", "Escenario", "Esquema de l'escenari", "Esquema del escenario", "Esquema do Cenario", "Esquema do Cenário", "First off", "Fono", "Forgatókönyv", "Forgatókönyv vázlat", "Fundo", "Garis Panduan Senario", "Geçmiş", "Grundlage", "Hannergrond", "Heave to", "Háttér", "Istorik", "Kazo", "Kazo-skizo", "Keadaan", "Kerangka Keadaan", "Kerangka Senario", "Kerangka Situasi", "Keçmiş", "Khung kịch bản", "Khung tình huống", "Koncept", "Konsep skenario", "Kontekst", "Kontekstas", "Konteksts", "Kontext", "Konturo de la scenaro", "Kontèks", "Kịch bản", "Latar Belakang", "Lýsing Atburðarásar", "Lýsing Dæma", "MISHUN", "MISHUN SRSLY", "Na primer", "Náčrt Scenára", "Náčrt Scenáru", "Náčrt Scénáře", "Oris scenarija", "Osnova", "Osnova Scenára", "Osnova scénáře", "Osnutek", "Ozadje", "Plan Senaryo", "Plan du Scénario", "Plan du scénario", "Plan senaryo", "Plang vum Szenario", "Pozadie", "Pozadina", "Pozadí", "Pregled na scenarija", "Primer", "Raamstsenaarium", "Reckon it's like", "Rerefons", "Scenarie", "Scenarij", "Scenarijaus šablonas", "Scenariju", "Scenariju-obris", "Scenarijus", "Scenario", "Scenario Amlinellol", "Scenario Outline", "Scenario Template", "Scenario-outline", "Scenariomal", "Scenariomall", "Scenariu", "Scenariusz", "Scenaro", "Scenár", "Scenārijs", "Scenārijs pēc parauga", "Schema dello scenario", "Scénario", "Scénář", "Senario", "Senaryo", "Senaryo Deskripsyon", "Senaryo deskripsyon", "Senaryo taslağı", "Shiver me timbers", "Situasi", "Situasie", "Situasie Uiteensetting", "Situācija", "Skenario", "Skenario konsep", "Skica", "Skizo", "Sodrzhina", "Ssenari", "Ssenarinin strukturu", "Structura scenariu", "Structură scenariu", "Struktura scenarija", "Stsenaarium", "Swa", "Swa hwaer swa", "Swa hwær swa", "Szablon scenariusza", "Szenario", "Szenariogrundriss", "Tapaus", "Tapausaihio", "Taust", "Tausta", "The thing of it is", "Tình huống", "Wharrimean is", "Yo-ho-ho", "Założenia", "lut", "lut chovnatlh", "mo'", "Ær", "Περιγραφή Σεναρίου", "Σενάριο", "Υπόβαθρο", "Агуулга", "Кереш", "Контекст", "Концепт", "На пример", "Основа", "Передумова", "Позадина", "Преглед на сценарија", "Предистория", "Предыстория", "Пример", "Рамка на сценарий", "Скица", "Содржина", "Структура сценария", "Структура сценарија", "Структура сценарію", "Сценар", "Сценарий", "Сценарий структураси", "Сценарийның төзелеше", "Сценарио", "Сценарын төлөвлөгөө", "Сценарій", "Тарих", "Կոնտեքստ", "Սցենար", "Սցենարի կառուցվացքը", "רקע", "תבנית תרחיש", "תרחיש", "الخلفية", "الگوی سناریو", "زمینه", "سناریو", "سيناريو", "سيناريو مخطط", "منظر نامے کا خاکہ", "منظرنامہ", "پس منظر", "परिदृश्य", "परिदृश्य रूपरेखा", "पृष्ठभूमि", "ਪਟਕਥਾ", "ਪਟਕਥਾ ਢਾਂਚਾ", "ਪਟਕਥਾ ਰੂਪ ਰੇਖਾ", "ਪਿਛੋਕੜ", "પરિદ્દશ્ય ઢાંચો", "પરિદ્દશ્ય રૂપરેખા", "બેકગ્રાઉન્ડ", "સ્થિતિ", "காட்சி", "காட்சி சுருக்கம்", "காட்சி வார்ப்புரு", "பின்னணி", "కథనం", "నేపథ్యం", "సన్నివేశం", "ಕಥಾಸಾರಾಂಶ", "ವಿವರಣೆ", "ಹಿನ್ನೆಲೆ", "สรุปเหตุการณ์", "เหตุการณ์", "แนวคิด", "โครงสร้างของเหตุการณ์", "კონტექსტი", "სცენარის", "სცენარის ნიმუში", "シナリオ", "シナリオアウトライン", "シナリオテンプレ", "シナリオテンプレート", "テンプレ", "剧本", "剧本大纲", "劇本", "劇本大綱", "场景", "场景大纲", "場景", "場景大綱", "背景", "배경", "시나리오", "시나리오 개요", "💤", "📕", "📖"] k[:examples] = Set.new [" நிலைமைகளில்", "Atburðarásir", "Beispiele", "Beispiller", "Cenarios", "Cenários", "Conto", "Contoh", "Contone", "Dead men tell no tales", "Dæmi", "Dữ liệu", "EXAMPLZ", "Egzanp", "Ejemplos", "Eksempler", "Ekzemploj", "Enghreifftiau", "Esempi", "Examples", "Exempel", "Exemple", "Exemples", "Exemplos", "Juhtumid", "Nümunələr", "Paraugs", "Pavyzdžiai", "Piemēri", "Primeri", "Primjeri", "Przykłady", "Príklady", "Példák", "Příklady", "Samplaí", "Scenaria", "Scenarijai", "Scenariji", "Scenarios", "Se the", "Se ðe", "Se þe", "Tapaukset", "Variantai", "Voorbeelde", "Voorbeelden", "You'll wanna", "ghantoH", "lutmey", "Örnekler", "Παραδείγματα", "Σενάρια", "Мисаллар", "Мисоллар", "Приклади", "Примери", "Примеры", "Сценарија", "Сценарији", "Тухайлбал", "Үрнәкләр", "Օրինակներ", "דוגמאות", "امثلة", "مثالیں", "نمونه ها", "उदाहरण", "ਉਦਾਹਰਨਾਂ", "ઉદાહરણો", "எடுத்துக்காட்டுகள்", "காட்சிகள்", "ఉదాహరణలు", "ಉದಾಹರಣೆಗಳು", "ชุดของตัวอย่าง", "ชุดของเหตุการณ์", "მაგალითები", "サンプル", "例", "例子", "예", "📓"] k[:step] = Set.new ["'a ", "'ach ", "'ej ", "* ", "7 ", "A ", "A taktiež ", "A také ", "A tiež ", "A zároveň ", "AN ", "Aber ", "Ac ", "Ach", "Adott ", "Agus", "Ak ", "Akkor ", "Ale ", "Aleshores ", "Ali ", "Allora ", "Alors ", "Als ", "Ama ", "Amennyiben ", "Amikor ", "Amma ", "Ampak ", "An ", "Ananging ", "Ancaq ", "And ", "Angenommen ", "Anrhegedig a ", "Ansin", "Apabila ", "Atesa ", "Atunci ", "Atès ", "Avast! ", "Aye ", "BUT ", "Bagi ", "Banjur ", "Bet ", "Biết ", "Blimey! ", "Buh ", "But ", "But at the end of the day I reckon ", "Cal ", "Cand ", "Cando ", "Ce ", "Cho ", "Cuando ", "Cuir i gcás go", "Cuir i gcás gur", "Cuir i gcás nach", "Cuir i gcás nár", "Când ", "DEN ", "DaH ghu' bejlu' ", "Dada ", "Dadas ", "Dadena ", "Dadeno ", "Dado ", "Dados ", "Daes ", "Dan ", "Dann ", "Dano ", "Daos ", "Dar ", "Dat fiind ", "Data ", "Date ", "Date fiind ", "Dati ", "Dati fiind ", "Dato ", "Daţi fiind ", "Dați fiind ", "De ", "Den youse gotta ", "Dengan ", "Diberi ", "Diyelim ki ", "Do ", "Donada ", "Donat ", "Donitaĵo ", "Dun ", "Duota ", "Dáu ", "E ", "Eeldades ", "Ef ", "En ", "Entao ", "Entonces ", "Então ", "Entón ", "Entós ", "Epi ", "Et ", "Et qu'", "Et que ", "Etant donné ", "Etant donné qu'", "Etant donné que ", "Etant donnée ", "Etant données ", "Etant donnés ", "Eğer ki ", "Fakat ", "Gangway! ", "Gdy ", "Gegeben sei ", "Gegeben seien ", "Gegeven ", "Gegewe ", "Gitt ", "Given ", "Givet ", "Givun ", "Ha ", "Həm ", "I ", "I CAN HAZ ", "In ", "Ir ", "It's just unbelievable ", "Ja ", "Jeśli ", "Jeżeli ", "Kad ", "Kada ", "Kadar ", "Kai ", "Kaj ", "Když ", "Kemudian ", "Ketika ", "Keď ", "Khi ", "Kiedy ", "Ko ", "Koga ", "Komence ", "Kui ", "Kuid ", "Kun ", "Lan ", "Le ", "Le sa a ", "Let go and haul ", "Logo ", "Lorsqu'", "Lorsque ", "Lè ", "Lè sa a ", "Ma ", "Maar ", "Mais ", "Mais qu'", "Mais que ", "Majd ", "Mając ", "Maka ", "Manawa ", "Mas ", "Men ", "Menawa ", "Mutta ", "Nalika ", "Nalikaning ", "Nanging ", "Nato ", "Nhưng ", "Niin ", "Njuk ", "No ", "Nuair a", "Nuair ba", "Nuair nach", "Nuair nár", "När ", "Når ", "Nə vaxt ki ", "O halda ", "O zaman ", "Och ", "Og ", "Oletetaan ", "Ond ", "Onda ", "Oraz ", "Pak ", "Pero ", "Peru ", "Però ", "Podano ", "Pokiaľ ", "Pokud ", "Potem ", "Potom ", "Privzeto ", "Pryd ", "Quan ", "Quand ", "Quando ", "Se ", "Sed ", "Si ", "Siis ", "Sipoze ", "Sipoze Ke ", "Sipoze ke ", "Soit ", "Stel ", "Så ", "Tad ", "Tada ", "Tak ", "Takrat ", "Tapi ", "Ter ", "Tetapi ", "Tha ", "Tha the ", "Then ", "Thurh ", "Thì ", "Toda ", "Togash ", "Too right ", "Tutaq ki ", "Un ", "Und ", "Ve ", "Vendar ", "Verilir ", "Và ", "Və ", "WEN ", "Wanneer ", "Wenn ", "When ", "Wtedy ", "Wun ", "Y ", "Y'know ", "Ya ", "Yeah nah ", "Yna ", "Youse know like when ", "Youse know when youse got ", "Za date ", "Za dati ", "Za dato ", "Za predpokladu ", "Za předpokladu ", "Zadan ", "Zadani ", "Zadano ", "Zakładając ", "Zakładając, że ", "Zaradi ", "Zatim ", "a ", "an ", "awer ", "dann ", "ghu' noblu' ", "latlh ", "mä ", "qaSDI' ", "ugeholl ", "vaj ", "wann ", "És ", "Étant donné ", "Étant donné qu'", "Étant donné que ", "Étant donnée ", "Étant données ", "Étant donnés ", "Ða ", "Ða ðe ", "Ðurh ", "Þa ", "Þa þe ", "Þegar ", "Þurh ", "Þá ", "Če ", "Şi ", "Əgər ", "Și ", "Όταν ", "Αλλά ", "Δεδομένου ", "Και ", "Τότε ", "І ", "А ", "А також ", "Агар ", "Але ", "Али ", "Аммо ", "Анх ", "Бирок ", "Ва ", "Вә ", "Гэхдээ ", "Дадена ", "Дадено ", "Дано ", "Допустим ", "Если ", "За дате ", "За дати ", "За дато ", "Затем ", "И ", "К тому же ", "Кад ", "Када ", "Кога ", "Когато ", "Когда ", "Коли ", "Лекин ", "Ләкин ", "Мөн ", "Нехай ", "Но ", "Нәтиҗәдә ", "Онда ", "Припустимо ", "Припустимо, що ", "Пусть ", "Та ", "Также ", "То ", "Тогаш ", "Тогда ", "Тоді ", "Тэгэхэд ", "Тэгээд ", "Унда ", "Харин ", "Хэрэв ", "Якщо ", "Үүний дараа ", "Һәм ", "Әгәр ", "Әйтик ", "Әмма ", "Өгөгдсөн нь ", "Ապա ", "Բայց ", "Դիցուք ", "Եթե ", "Եվ ", "Երբ ", "אבל ", "אז ", "אזי ", "בהינתן ", "וגם ", "כאשר ", "آنگاه ", "اذاً ", "اما ", "اور ", "اگر ", "با فرض ", "بالفرض ", "بفرض ", "تب ", "ثم ", "جب ", "عندما ", "فرض کیا ", "لكن ", "لیکن ", "متى ", "هنگامی ", "و ", "پھر ", "अगर ", "और ", "कदा ", "किन्तु ", "चूंकि ", "जब ", "तथा ", "तदा ", "तब ", "पर ", "परन्तु ", "यदि ", "ਅਤੇ ", "ਜਦੋਂ ", "ਜਿਵੇਂ ਕਿ ", "ਜੇਕਰ ", "ਤਦ ", "ਪਰ ", "અને ", "આપેલ છે ", "ક્યારે ", "પછી ", "પણ ", "அப்பொழுது ", "ஆனால் ", "எப்போது ", "கொடுக்கப்பட்ட ", "மற்றும் ", "மேலும் ", "అప్పుడు ", "ఈ పరిస్థితిలో ", "కాని ", "చెప్పబడినది ", "మరియు ", "ಆದರೆ ", "ನಂತರ ", "ನೀಡಿದ ", "ಮತ್ತು ", "ಸ್ಥಿತಿಯನ್ನು ", "กำหนดให้ ", "ดังนั้น ", "เมื่อ ", "แต่ ", "และ ", "და", "მაგ­რამ", "მაშინ", "მოცემული", "როდესაც", "かつ", "しかし", "ただし", "ならば", "もし", "並且", "但し", "但是", "假如", "假定", "假設", "假设", "前提", "同时", "同時", "并且", "当", "當", "而且", "那么", "那麼", "그러면", "그리고", "단", "만약", "만일", "먼저", "조건", "하지만", "🎬", "😂", "😐", "😔", "🙏"] end end end end rouge-2.2.1/lib/rouge/lexers/vhdl.rb0000644000175000017500000000553013150713277017155 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class VHDL < RegexLexer title "VHDL 2008" desc "Very High Speed Integrated Circuit Hardware Description Language" tag 'vhdl' filenames '*.vhd', '*.vhdl', '*.vho' mimetypes 'text/x-vhdl' def self.keywords @keywords ||= Set.new %w( access after alias all architecture array assert assume assume_guarantee attribute begin block body buffer bus case component configuration constant context cover default disconnect downto else elsif end entity exit fairness file for force function generate generic group guarded if impure in inertial inout is label library linkage literal loop map new next null of on open others out package parameter port postponed procedure process property protected pure range record register reject release report return select sequence severity shared signal strong subtype then to transport type unaffected units until use variable vmode vprop vunit wait when while with ) end def self.keywords_type @keywords_type ||= Set.new %w( bit bit_vector boolean boolean_vector character integer integer_vector natural positive real real_vector severity_level signed std_logic std_logic_vector std_ulogic std_ulogic_vector string unsigned time time__vector ) end def self.operator_words @operator_words ||= Set.new %w( abs and mod nand nor not or rem rol ror sla sll sra srl xnor xor ) end id = /[a-zA-Z][a-zA-Z0-9_]*/ state :whitespace do rule /\s+/, Text rule /\n/, Text # Find Comments (VHDL doesn't support multiline comments) rule /--.*$/, Comment::Single end state :statements do # Find Numbers rule /-?\d+/i, Num::Integer rule /-?\d+[.]\d+/i, Num::Float # Find Strings rule /[box]?"[^"]*"/i, Str::Single rule /'[^']?'/i, Str::Char # Find Attributes rule /'#{id}/i, Name::Attribute # Punctuations rule /[(),:;]/, Punctuation # Boolean and NULL rule /(?:true|false|null)\b/i, Name::Builtin rule id do |m| match = m[0].downcase #convert to lower case if self.class.keywords.include? match token Keyword elsif self.class.keywords_type.include? match token Keyword::Type elsif self.class.operator_words.include? match token Operator::Word else token Name end end rule( %r(=>|[*][*]|:=|\/=|>=|<=|<>|\?\?|\?=|\?\/=|\?>|\?<|\?>=|\?<=|<<|>>|[#&'*+-.\/:<=>\?@^]), Operator ) end state :root do mixin :whitespace mixin :statements end end end end rouge-2.2.1/lib/rouge/lexers/sed.rb0000644000175000017500000000762213150713277016777 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Sed < RegexLexer title "sed" desc 'sed, the ultimate stream editor' tag 'sed' filenames '*.sed' mimetypes 'text/x-sed' def self.analyze_text(text) return 1 if text.shebang? 'sed' end class Regex < RegexLexer state :root do rule /\\./, Str::Escape rule /\[/, Punctuation, :brackets rule /[$^.*]/, Operator rule /[()]/, Punctuation rule /./, Str::Regex end state :brackets do rule /\^/ do token Punctuation goto :brackets_int end rule(//) { goto :brackets_int } end state :brackets_int do # ranges rule /.-./, Name::Variable rule /\]/, Punctuation, :pop! rule /./, Str::Regex end end class Replacement < RegexLexer state :root do rule /\\./m, Str::Escape rule /&/, Operator rule /[^\\&]+/m, Text end end def regex @regex ||= Regex.new(options) end def replacement @replacement ||= Replacement.new(options) end start { regex.reset!; replacement.reset! } state :whitespace do rule /\s+/m, Text rule(/#.*?\n/) { token Comment; reset_stack } rule(/\n/) { token Text; reset_stack } rule(/;/) { token Punctuation; reset_stack } end state :root do mixin :addr_range end edot = /\\.|./m state :command do mixin :whitespace # subst and transliteration rule /(s)(.)(#{edot}*?)(\2)(#{edot}*?)(\2)/m do |m| token Keyword, m[1] token Punctuation, m[2] delegate regex, m[3] token Punctuation, m[4] delegate replacement, m[5] token Punctuation, m[6] goto :flags end rule /(y)(.)(#{edot}*?)(\2)(#{edot}*?)(\2)/m do |m| token Keyword, m[1] token Punctuation, m[2] delegate replacement, m[3] token Punctuation, m[4] delegate replacement, m[5] token Punctuation, m[6] pop! end # commands that take a text segment as an argument rule /([aic])(\s*)/ do groups Keyword, Text; goto :text end rule /[pd]/, Keyword # commands that take a number argument rule /([qQl])(\s+)(\d+)/i do groups Keyword, Text, Num pop! end # no-argument commands rule /[={}dDgGhHlnpPqx]/, Keyword, :pop! # commands that take a filename argument rule /([rRwW])(\s+)(\S+)/ do groups Keyword, Text, Name pop! end # commands that take a label argument rule /([:btT])(\s+)(\S+)/ do groups Keyword, Text, Name::Label pop! end end state :addr_range do mixin :whitespace ### address ranges ### addr_tok = Keyword::Namespace rule /\d+/, addr_tok rule /[$,~+!]/, addr_tok rule %r((/)((?:\\.|.)*?)(/)) do |m| token addr_tok, m[1]; delegate regex, m[2]; token addr_tok, m[3] end # alternate regex rage delimiters rule %r((\\)(.)(\\.|.)*?(\2)) do |m| token addr_tok, m[1] + m[2] delegate regex, m[3] token addr_tok, m[4] end rule(//) { push :command } end state :text do rule /[^\\\n]+/, Str rule /\\\n/, Str::Escape rule /\\/, Str rule /\n/, Text, :pop! end state :flags do rule /[gp]+/, Keyword, :pop! # writing to a file with the subst command. # who'da thunk...? rule /([wW])(\s+)(\S+)/ do token Keyword; token Text; token Name end rule(//) { pop! } end end end end rouge-2.2.1/lib/rouge/lexers/io.rb0000644000175000017500000000321313150713277016623 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class IO < RegexLexer tag 'io' title "Io" desc 'The IO programming language (http://iolanguage.com)' mimetypes 'text/x-iosrc' filenames '*.io' def self.analyze_text(text) return 1 if text.shebang? 'io' end def self.constants @constants ||= Set.new %w(nil false true) end def self.builtins @builtins ||= Set.new %w( args call clone do doFile doString else elseif for if list method return super then ) end state :root do rule /\s+/m, Text rule %r(//.*?\n), Comment::Single rule %r(#.*?\n), Comment::Single rule %r(/(\\\n)?[*].*?[*](\\\n)?/)m, Comment::Multiline rule %r(/[+]), Comment::Multiline, :nested_comment rule /"(\\\\|\\"|[^"])*"/, Str rule %r(:?:=), Keyword rule /[()]/, Punctuation rule %r([-=;,*+>|+=:;,./?-`]), Operator rule %r(\d{1,3}(_\d{3})+\.\d{1,3}(_\d{3})+[kMGTPmunpf]?), Literal::Number::Float rule %r(\d{1,3}(_\d{3})+\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?), Literal::Number::Float rule %r([0-9][0-9]*\.\d{1,3}(_\d{3})+[kMGTPmunpf]?), Literal::Number::Float rule %r([0-9][0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?), Literal::Number::Float rule %r(#([0-9a-fA-F]{4})(_[0-9a-fA-F]{4})+), Literal::Number::Hex rule %r(#[0-9a-fA-F]+), Literal::Number::Hex rule %r(\$([01]{4})(_[01]{4})+), Literal::Number::Bin rule %r(\$[01]+), Literal::Number::Bin rule %r(\d{1,3}(_\d{3})+[kMGTP]?), Literal::Number::Integer rule %r([0-9]+[kMGTP]?), Literal::Number::Integer rule %r(\n), Text end state :class do mixin :whitespace rule %r([A-Za-z_]\w*), Name::Class, :pop! end state :import do rule %r([a-z][\w.]*), Name::Namespace, :pop! rule %r("(\\\\|\\"|[^"])*"), Literal::String, :pop! end state :comment do rule %r([^*/]), Comment.Multiline rule %r(/\*), Comment::Multiline, :push! rule %r(\*/), Comment::Multiline, :pop! rule %r([*/]), Comment::Multiline end end end end rouge-2.2.1/lib/rouge/lexers/scss.rb0000644000175000017500000000136713150713277017177 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers load_lexer 'sass/common.rb' class Scss < SassCommon title "SCSS" desc "SCSS stylesheets (sass-lang.com)" tag 'scss' filenames '*.scss' mimetypes 'text/x-scss' state :root do rule /\s+/, Text rule %r(//.*?\n), Comment::Single rule %r(/[*].*?[*]/)m, Comment::Multiline rule /@import\b/, Keyword, :value mixin :content_common rule(/(?=[^;{}][;}])/) { push :attribute } rule(/(?=[^;{}:]+:[^a-z])/) { push :attribute } rule(//) { push :selector } end state :end_section do rule /\n/, Text rule(/[;{}]/) { token Punctuation; reset_stack } end end end end rouge-2.2.1/lib/rouge/lexers/cfscript.rb0000644000175000017500000000763113150713277020041 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Cfscript < RegexLexer title "CFScript" desc 'CFScript, the CFML scripting language' tag 'cfscript' aliases 'cfc' filenames '*.cfc' def self.keywords @keywords ||= %w( if else var xml default break switch do try catch throw in continue for return while required ) end def self.declarations @declarations ||= %w( component property function remote public package private ) end def self.types @types ||= %w( any array binary boolean component date guid numeric query string struct uuid void xml ) end constants = %w(application session client cookie super this variables arguments cgi) operators = %w(\+\+ -- && \|\| <= >= < > == != mod eq lt gt lte gte not is and or xor eqv imp equal contains \? ) dotted_id = /[$a-zA-Z_][a-zA-Z0-9_.]*/ state :root do mixin :comments_and_whitespace rule /(?:#{operators.join('|')}|does not contain|greater than(?: or equal to)?|less than(?: or equal to)?)\b/i, Operator, :expr_start rule %r([-<>+*%&|\^/!=]=?), Operator, :expr_start rule /[(\[,]/, Punctuation, :expr_start rule /;/, Punctuation, :statement rule /[)\].]/, Punctuation rule /[?]/ do token Punctuation push :ternary push :expr_start end rule /[{}]/, Punctuation, :statement rule /(?:#{constants.join('|')})\b/, Name::Constant rule /(?:true|false|null)\b/, Keyword::Constant rule /import\b/, Keyword::Namespace, :import rule /(#{dotted_id})(\s*)(:)(\s*)/ do groups Name, Text, Punctuation, Text push :expr_start end rule /([A-Za-z_$][\w.]*)(\s*)(\()/ do |m| if self.class.keywords.include? m[1] token Keyword, m[1] token Text, m[2] token Punctuation, m[3] else token Name::Function, m[1] token Text, m[2] token Punctuation, m[3] end end rule dotted_id do |m| if self.class.declarations.include? m[0] token Keyword::Declaration push :expr_start elsif self.class.keywords.include? m[0] token Keyword push :expr_start elsif self.class.types.include? m[0] token Keyword::Type push :expr_start else token Name::Other end end rule /[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?/, Num::Float rule /0x[0-9a-fA-F]+/, Num::Hex rule /[0-9]+/, Num::Integer rule /"(\\\\|\\"|[^"])*"/, Str::Double rule /'(\\\\|\\'|[^'])*'/, Str::Single end # same as java, broken out state :comments_and_whitespace do rule /\s+/, Text rule %r(//.*?$), Comment::Single rule %r(/\*.*?\*/)m, Comment::Multiline end state :expr_start do mixin :comments_and_whitespace rule /[{]/, Punctuation, :object rule //, Text, :pop! end state :statement do rule /[{}]/, Punctuation mixin :expr_start end # object literals state :object do mixin :comments_and_whitespace rule /[}]/ do token Punctuation push :expr_start end rule /(#{dotted_id})(\s*)(:)/ do groups Name::Other, Text, Punctuation push :expr_start end rule /:/, Punctuation mixin :root end # ternary expressions, where : is not a label! state :ternary do rule /:/ do token Punctuation goto :expr_start end mixin :root end state :import do rule /\s+/m, Text rule /[a-z0-9_.]+\*?/i, Name::Namespace, :pop! end end end end rouge-2.2.1/lib/rouge/lexers/pony.rb0000644000175000017500000000470413150713277017207 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class Pony < RegexLexer tag 'pony' filenames '*.pony' keywords = Set.new %w( actor addressof and as be break class compiler_intrinsic consume continue do else elseif embed end error for fun if ifdef in interface is isnt lambda let match new not object primitive recover repeat return struct then this trait try type until use var where while with ) capabilities = Set.new %w( box iso ref tag trn val ) types = Set.new %w( Number Signed Unsigned Float I8 I16 I32 I64 I128 U8 U32 U64 U128 F32 F64 EventID Align IntFormat NumberPrefix FloatFormat Type ) state :whitespace do rule /[\s\t\r\n]+/m, Text end state :root do mixin :whitespace rule /"""/, Str::Doc, :docstring rule %r{//(.*?)\n}, Comment::Single rule %r{/(\\\n)?[*](.|\n)*?[*](\\\n)?/}, Comment::Multiline rule /"/, Str, :string rule %r([~!%^&*+=\|?:<>/-]), Operator rule /(true|false|NULL)\b/, Name::Constant rule %r{(?:[A-Z_][a-zA-Z0-9_]*)}, Name::Class rule /[()\[\],.';]/, Punctuation # Numbers rule /0[xX]([0-9a-fA-F_]*\.[0-9a-fA-F_]+|[0-9a-fA-F_]+)[pP][+\-]?[0-9_]+[fFL]?[i]?/, Num::Float rule /[0-9_]+(\.[0-9_]+[eE][+\-]?[0-9_]+|\.[0-9_]*|[eE][+\-]?[0-9_]+)[fFL]?[i]?/, Num::Float rule /\.(0|[1-9][0-9_]*)([eE][+\-]?[0-9_]+)?[fFL]?[i]?/, Num::Float rule /0[xX][0-9a-fA-F_]+/, Num::Hex rule /(0|[1-9][0-9_]*)([LUu]|Lu|LU|uL|UL)?/, Num::Integer rule /[a-z_][a-z0-9_]*/io do |m| match = m[0] if capabilities.include?(match) token Keyword::Declaration elsif keywords.include?(match) token Keyword::Reserved elsif types.include?(match) token Keyword::Type else token Name end end end state :string do rule /"/, Str, :pop! rule /\\([\\abfnrtv"']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})/, Str::Escape rule /[^\\"\n]+/, Str rule /\\\n/, Str rule /\\/, Str # stray backslash end state :docstring do rule /"""/, Str::Doc, :pop! rule /\n/, Str::Doc rule /./, Str::Doc end end end end rouge-2.2.1/lib/rouge/lexers/html.rb0000644000175000017500000000566213150713277017172 0ustar uwabamiuwabami# -*- coding: utf-8 -*- # module Rouge module Lexers class HTML < RegexLexer title "HTML" desc "HTML, the markup language of the web" tag 'html' filenames '*.htm', '*.html', '*.xhtml' mimetypes 'text/html', 'application/xhtml+xml' def self.analyze_text(text) return 1 if text.doctype?(/\bhtml\b/i) return 1 if text =~ /<\s*html\b/ end start do @javascript = Javascript.new(options) @css = CSS.new(options) end state :root do rule /[^<&]+/m, Text rule /&\S*?;/, Name::Entity rule //im, Comment::Preproc rule //m, Comment::Preproc rule //, Comment, :pop! rule /-/, Comment end state :tag do rule /\s+/m, Text rule /[a-zA-Z0-9_:-]+\s*=/m, Name::Attribute, :attr rule /[a-zA-Z0-9_:-]+/, Name::Attribute rule %r(/?\s*>)m, Name::Tag, :pop! end state :attr do # TODO: are backslash escapes valid here? rule /"/ do token Str goto :dq end rule /'/ do token Str goto :sq end rule /[^\s>]+/, Str, :pop! end state :dq do rule /"/, Str, :pop! rule /[^"]+/, Str end state :sq do rule /'/, Str, :pop! rule /[^']+/, Str end state :script_content do rule %r([^<]+) do delegate @javascript end rule %r(<\s*/\s*script\s*>)m, Name::Tag, :pop! rule %r(<) do delegate @javascript end end state :style_content do rule /[^<]+/ do delegate @css end rule %r(<\s*/\s*style\s*>)m, Name::Tag, :pop! rule / Title!

Hello, World!

rouge-2.2.1/lib/rouge/demos/tcl0000644000175000017500000000006113150713277016177 0ustar uwabamiuwabamiproc cross_sum {s} {expr [join [split $s ""] +]} rouge-2.2.1/lib/rouge/demos/sieve0000644000175000017500000000030113150713277016525 0ustar uwabamiuwabamirequire "fileinto"; require "imap4flags"; if header :is "X-Spam" "Yes" { fileinto "Junk"; setflag "\\seen"; stop; } /* Other messages get filed into Inbox or to user's scripts */ rouge-2.2.1/lib/rouge/demos/perl0000644000175000017500000000011013150713277016352 0ustar uwabamiuwabami#!/usr/bin/env perl use warnings; print "a: "; my $a = "foo"; print $a; rouge-2.2.1/lib/rouge/demos/eiffel0000644000175000017500000000062713150713277016657 0ustar uwabamiuwabaminote description: "Represents a person." class PERSON create make, make_unknown feature {NONE} -- Creation make (a_name: like name) -- Create a person with `a_name' as `name'. do name := a_name ensure name = a_name end make_unknown do ensure name = Void end feature -- Access name: detachable STRING -- Full name or Void if unknown. end rouge-2.2.1/lib/rouge/demos/c0000644000175000017500000000031013150713277015634 0ustar uwabamiuwabami#include "ruby/ruby.h" static int clone_method_i(st_data_t key, st_data_t value, st_data_t data) { clone_method((VALUE)data, (ID)key, (const rb_method_entry_t *)value); return ST_CONTINUE; } rouge-2.2.1/lib/rouge/demos/applescript0000644000175000017500000000012613150713277017745 0ustar uwabamiuwabami-- AppleScript playing with iTunes tell application "iTunes" to get current selection rouge-2.2.1/lib/rouge/demos/turtle0000644000175000017500000000155613150713277016746 0ustar uwabamiuwabami@prefix xsd: @prefix dcat: . @prefix dcterms: . @prefix foaf: . @base . PREFIX test: PrEfIx insensitive: GRAPH { a dcat:Dataset ; #-----Mandatory-----# dcterms:title 'Test title'@cs, "Test title"@en ; dcterms:description """Multiline string"""@cs, '''Another multiline string '''@en ; #-----Recommended-----# dcat:contactPoint [ a foaf:Person ] ; test:list ( 1 1.1 +1 -1 1.2E+4 "Test" "\"Quote\"" ) ; test:datatype "2016-07-20"^^xsd:date ; test:text """next multiline"""; . } rouge-2.2.1/lib/rouge/demos/dart0000644000175000017500000000013413150713277016350 0ustar uwabamiuwabamivoid main() { var collection=[1,2,3,4,5]; for(var a in collection){ print(a); } } rouge-2.2.1/lib/rouge/demos/docker0000644000175000017500000000017413150713277016671 0ustar uwabamiuwabamimaintainer First O'Last run echo \ 123 $bar # comment onbuild add . /app/src onbuild run echo \ 123 $bar CMD /bin/bash rouge-2.2.1/lib/rouge/demos/javascript0000644000175000017500000000006413150713277017566 0ustar uwabamiuwabami$(document).ready(function() { alert('ready!'); }); rouge-2.2.1/lib/rouge/demos/json-doc0000644000175000017500000000011513150713277017131 0ustar uwabamiuwabami{ "one": 1, "two": 2, "null": null, "simple": true } // a simple json object rouge-2.2.1/lib/rouge/demos/io0000644000175000017500000000046713150713277016036 0ustar uwabamiuwabamibottle := method(i, if(i==0, return "no more bottles of beer") if(i==1, return "1 bottle of beer") return i asString .. " bottles of beer" ) for(i, 99, 1, -1, write(bottle(i), " on the wall, ", bottle(i), ",\n") write("take one down, pass it around,\n") write(bottle(i - 1), " on the wall.\n\n") ) rouge-2.2.1/lib/rouge/demos/pony0000644000175000017500000000052613150713277016410 0ustar uwabamiuwabamiuse "ponytest" actor Main is TestList new create(env: Env) => PonyTest(env, this) new make() => None fun tag tests(test: PonyTest) => test(_TestAddition) class iso _TestAddition is UnitTest """ Adding 2 numbers """ fun name(): String => "u32/add" fun apply(h: TestHelper): TestResult => h.expect_eq[U32](2 + 2, 4) rouge-2.2.1/lib/rouge/demos/awk0000644000175000017500000000016513150713277016204 0ustar uwabamiuwabamiBEGIN { # Simulate echo(1) for (i = 1; i < ARGC; i++) printf "%s ", ARGV[i] printf "\n" exit } rouge-2.2.1/lib/rouge/demos/properties0000644000175000017500000000042113150713277017611 0ustar uwabamiuwabami# You are reading the ".properties" entry. ! The exclamation mark can also mark text as comments. website = http\://en.wikipedia.org/ language = English country : Poland continent=Europe key.with.dots=This is the value that could be looked up with the key "key.with.dots". rouge-2.2.1/lib/rouge/demos/slim0000644000175000017500000000056413150713277016371 0ustar uwabamiuwabamidoctype html html body h1 Markup examples #content p | Slim can have #{ruby_code} interpolated! /[if IE] javascript: alert('Slim supports embedded javascript!') - unless items.empty? table - for item in items do tr td.name = item.name td.price = item.price rouge-2.2.1/lib/rouge/demos/q0000644000175000017500000000002413150713277015654 0ustar uwabamiuwabami/ comment x: til 10 rouge-2.2.1/lib/rouge/demos/php0000644000175000017500000000004413150713277016205 0ustar uwabamiuwabami rouge-2.2.1/lib/rouge/demos/verilog0000644000175000017500000000064413150713277017073 0ustar uwabamiuwabami/** * Verilog Lexer */ module Foo( input logic Clk_CI, input logic Rst_RBI, input logic A, input logic B, output logic C ); logic C_DN, C_DP; assign C = C_DP; always_comb begin : proc_next_state C_DN = A + B; end // Clocked process always_ff @(posedge Clk_CI, negedge Rst_RBI) begin if(~Rst_RBI) begin C_DP <= 1'b0; end else begin C_DP <= C_DN; end end endmodule rouge-2.2.1/lib/rouge/demos/conf0000644000175000017500000000011013150713277016335 0ustar uwabamiuwabami# A generic configuration file option1 "val1" option2 23 option3 'val3' rouge-2.2.1/lib/rouge/demos/css0000644000175000017500000000012513150713277016206 0ustar uwabamiuwabamibody { font-size: 12pt; background: #fff url(temp.png) top left no-repeat; } rouge-2.2.1/lib/rouge/demos/tsx0000644000175000017500000000056513150713277016244 0ustar uwabamiuwabamiclass HelloWorld extends React.Component<{date: Date}, void> { render() { return (

Hello, ! It is {this.props.date.toTimeString()}

); } } setInterval(function() { ReactDOM.render( , document.getElementById('example') ); }, 500); rouge-2.2.1/lib/rouge/demos/vhdl0000644000175000017500000000062113150713277016354 0ustar uwabamiuwabamientity toggle_demo is port ( clk_in : in std_logic; -- System Clock data_q : out std_logic -- Toggling Port ); end entity toggle_demo; architecture RTL of toggle_demo is signal data : std_logic := '0'; begin data_q <= data; data_proc : process (clk_in) begin if (rising_edge(clk_in)) then data <= not data; end if; end process; end architecture RTL; rouge-2.2.1/lib/rouge/demos/tap0000644000175000017500000000023713150713277016206 0ustar uwabamiuwabamiok 1 - Input file opened not ok 2 - First line of the input valid ok 3 - Read the rest of the file not ok 4 - Summarized correctly # TODO Not written yet 1..4 rouge-2.2.1/lib/rouge/demos/puppet0000644000175000017500000000017713150713277016742 0ustar uwabamiuwabamiservice { 'ntp': name => $service_name, ensure => running, enable => true, subscribe => File['ntp.conf'], } rouge-2.2.1/lib/rouge/demos/rust0000644000175000017500000000042613150713277016417 0ustar uwabamiuwabamiuse core::*; fn main() { for ["Alice", "Bob", "Carol"].each |&name| { do task::spawn { let v = rand::Rng().shuffle([1, 2, 3]); for v.each |&num| { io::print(fmt!("%s says: '%d'\n", name, num)) } } } } rouge-2.2.1/lib/rouge/demos/digdag0000644000175000017500000000054713150713277016645 0ustar uwabamiuwabami# this is digdag task definitions timezone: UTC +setup: echo>: start ${session_time} +disp_current_date: echo>: ${moment(session_time).utc().format('YYYY-MM-DD HH:mm:ss Z')} +repeat: for_each>: order: [first, second, third] animal: [dog, cat] _do: echo>: ${order} ${animal} _parallel: true +teardown: echo>: finish ${session_time} rouge-2.2.1/lib/rouge/demos/smalltalk0000644000175000017500000000023513150713277017404 0ustar uwabamiuwabamiquadMultiply: i1 and: i2 "This method multiplies the given numbers by each other and the result by 4." | mul | mul := i1 * i2. ^mul * 4 rouge-2.2.1/lib/rouge/demos/typescript0000644000175000017500000000006413150713277017626 0ustar uwabamiuwabami$(document).ready(function() { alert('ready!'); }); rouge-2.2.1/lib/rouge/demos/erb0000644000175000017500000000003513150713277016166 0ustar uwabamiuwabami<%= @title %> rouge-2.2.1/lib/rouge/demos/cpp0000644000175000017500000000013413150713277016200 0ustar uwabamiuwabami#include using namespace std; int main() { cout << "Hello World" << endl; } rouge-2.2.1/lib/rouge/demos/fsharp0000644000175000017500000000047413150713277016710 0ustar uwabamiuwabami(* Binary tree with leaves car­rying an integer. *) type Tree = Leaf of int | Node of Tree * Tree let rec existsLeaf test tree = match tree with | Leaf v -> test v | Node (left, right) -> existsLeaf test left || existsLeaf test right let hasEvenLeaf tree = existsLeaf (fun n -> n % 2 = 0) treerouge-2.2.1/lib/rouge/demos/d0000644000175000017500000000070313150713277015643 0ustar uwabamiuwabamiimport std.algorithm, std.conv, std.functional, std.math, std.regex, std.stdio; alias round = pipe!(to!real, std.math.round, to!string); static reFloatingPoint = ctRegex!`[0-9]+\.[0-9]+`; void main() { // Replace anything that looks like a real // number with the rounded equivalent. stdin .byLine .map!(l => l.replaceAll!(c => c.hit.round) (reFloatingPoint)) .each!writeln; } rouge-2.2.1/lib/rouge/demos/literate_coffeescript0000644000175000017500000000011513150713277021762 0ustar uwabamiuwabamiImport the helpers we plan to use. {extend, last} = require './helpers' rouge-2.2.1/lib/rouge/demos/ocaml0000644000175000017500000000050513150713277016513 0ustar uwabamiuwabami(* Binary tree with leaves car­rying an integer. *) type tree = Leaf of int | Node of tree * tree let rec exists_leaf test tree = match tree with | Leaf v -> test v | Node (left, right) -> exists_leaf test left || exists_leaf test right let has_even_leaf tree = exists_leaf (fun n -> n mod 2 = 0) tree rouge-2.2.1/lib/rouge/demos/bsl0000644000175000017500000000032513150713277016200 0ustar uwabamiuwabami#Область ПрограммныйИнтерфейс Процедура ПриветМир() Экспорт Сообщить("Привет мир"); КонецПроцедуры #КонецОбластиrouge-2.2.1/lib/rouge/demos/nasm0000644000175000017500000000106613150713277016361 0ustar uwabamiuwabami%macro IRQ 2 global irq%1 irq%1: cli push byte 0 ; push a dummy error code push byte %2 ; push the IRQ number jmp irq_common_stub %endmacro extern irq_handler irq_common_stub: pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax mov ax, ds ; Lower 16-bits of eax = ds. push eax ; save the data segment descriptor mov ax, 0x10 ; load the kernel data segment descriptor mov edx, eax call irq_handler %assign i 0 %rep 8 ISR_NOERRCODE i %assign i i+1 %endrep ISR_NOERRCODE 9 rouge-2.2.1/lib/rouge/demos/tex0000644000175000017500000000005713150713277016222 0ustar uwabamiuwabamiTo write \LaTeX\ you would type \verb:\LaTeX:. rouge-2.2.1/lib/rouge/demos/make0000644000175000017500000000013313150713277016332 0ustar uwabamiuwabami.PHONY: all all: $(OBJ) $(OBJ): $(SOURCE) @echo "compiling..." $(GCC) $(CFLAGS) $< > $@ rouge-2.2.1/lib/rouge/demos/nix0000644000175000017500000000074013150713277016217 0ustar uwabamiuwabami# See https://nixos.org/nix/manual/#sec-expression-syntax { stdenv, fetchurl, perl }: # 1 stdenv.mkDerivation { # 2 name = "hello-2.1.1"; # 3 builder = ./builder.sh; # 4 meta = rec { name = "rouge"; version = "${name}-2.1.1"; number = 55 + 12; isSmaller = number < 42; bool = true; }; src = fetchurl { # 5 url = ftp://ftp.nluug.nl/pub/gnu/hello/hello-2.1.1.tar.gz; # path md5 = "70c9ccf9fac07f762c24f2df2290784d"; }; inherit perl; # 6 } rouge-2.2.1/lib/rouge/demos/viml0000644000175000017500000000104613150713277016370 0ustar uwabamiuwabamifunction! s:Make(dir, make, format, name) abort let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' let cwd = getcwd() let [mp, efm, cc] = [&l:mp, &l:efm, get(b:, 'current_compiler', '')] try execute cd fnameescape(dir) let [&l:mp, &l:efm, b:current_compiler] = [a:make, a:format, a:compiler] execute (exists(':Make') == 2 ? 'Make' : 'make') finally let [&l:mp, &l:efm, b:current_compiler] = [mp, efm, cc] if empty(cc) | unlet! b:current_compiler | endif execute cd fnameescape(cwd) endtry endfunction rouge-2.2.1/lib/rouge/demos/handlebars0000644000175000017500000000023613150713277017524 0ustar uwabamiuwabami

{{title}}

{{#with story}}
{{{intro}}}
{{{body}}}
{{/with}}
rouge-2.2.1/lib/rouge/demos/sml0000644000175000017500000000031613150713277016213 0ustar uwabamiuwabamidatatype shape = Circle of loc * real (* center and radius *) | Square of loc * real (* upper-left corner and side length; axis-aligned *) | Triangle of loc * loc * loc (* corners *) rouge-2.2.1/lib/rouge/demos/coffeescript0000644000175000017500000000012513150713277020072 0ustar uwabamiuwabami# Objects: math = root: Math.sqrt square: square cube: (x) -> x * square x rouge-2.2.1/lib/rouge/demos/haskell0000644000175000017500000000031213150713277017037 0ustar uwabamiuwabamiquicksort :: Ord a => [a] -> [a] quicksort [] = [] quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater) where lesser = filter (< p) xs greater = filter (>= p) xs rouge-2.2.1/lib/rouge/demos/fortran0000644000175000017500000000102013150713277017064 0ustar uwabamiuwabamiprogram bottles implicit none integer :: nbottles do nbottles = 99, 1, -1 call print_bottles(nbottles) end do contains subroutine print_bottles(n) implicit none integer, intent(in) :: n write(*, "(I0, 1X, 'bottles of beer on the wall,')") n write(*, "(I0, 1X, 'bottles of beer.')") n write(*, "('Take one down, pass it around,')") write(*, "(I0, 1X, 'bottles of beer on the wall.', /)") n - 1 end subroutine print_bottles end program bottles rouge-2.2.1/lib/rouge/demos/racket0000644000175000017500000000116113150713277016670 0ustar uwabamiuwabami#lang racket ;; draw a graph of cos and deriv^3(cos) (require plot) (define ((deriv f) x) (/ (- (f x) (f (- x 0.001))) 0.001)) (define (thrice f) (lambda (x) (f (f (f x))))) (plot (list (function ((thrice deriv) sin) -5 5) (function cos -5 5 #:color 'blue))) ;; Print the Greek alphabet (for ([i (in-range 25)]) (displayln (integer->char (+ i (char->integer #\u3B1))))) ;; An echo server (define listener (tcp-listen 12345)) (let echo-server () (define-values (in out) (tcp-accept listener)) (thread (λ () (copy-port in out) (close-output-port out))) (echo-server)) rouge-2.2.1/lib/rouge/demos/hylang0000644000175000017500000000053013150713277016700 0ustar uwabamiuwabami(defn simple-conversation [] (print "Hello! I'd like to get to know you. Tell me about yourself!") (setv name (input "What is your name? ")) (let [age (input "What is your age? ")] (if (and age name) (print (+ "Hello " name "! I see you are " age " years old."))))) (simple-conversation) rouge-2.2.1/lib/rouge/demos/scheme0000644000175000017500000000016513150713277016666 0ustar uwabamiuwabami(define Y (lambda (m) ((lambda (f) (m (lambda (a) ((f f) a)))) (lambda (f) (m (lambda (a) ((f f) a))))))) rouge-2.2.1/lib/rouge/demos/r0000644000175000017500000000021013150713277015652 0ustar uwabamiuwabamidbenford <- function(x){ log10(1 + 1/x) } pbenford <- function(q){ cumprobs <- cumsum(dbenford(1:9)) return(cumprobs[q]) } rouge-2.2.1/lib/rouge/demos/graphql0000644000175000017500000000035113150713277017055 0ustar uwabamiuwabamiquery myQuery($variable: Boolean) { # Queries can have comments! friends(ids: ["a1", "a2"]) { id name ...someFields ... @include(if: $variable) { foo } ... @skip(if: true) { bar } } } rouge-2.2.1/lib/rouge/demos/go0000644000175000017500000000011213150713277016017 0ustar uwabamiuwabamipackage main import "fmt" func main() { fmt.Println("Hello, 世界") } rouge-2.2.1/lib/rouge/demos/elixir0000644000175000017500000000004613150713277016714 0ustar uwabamiuwabamiEnum.map([1,2,3], fn(x) -> x * 2 end) rouge-2.2.1/lib/rouge/demos/protobuf0000644000175000017500000000014513150713277017260 0ustar uwabamiuwabamimessage Person { required string name = 1; required int32 id = 2; optional string email = 3; } rouge-2.2.1/lib/rouge/demos/nim0000644000175000017500000000170213150713277016203 0ustar uwabamiuwabamiimport math,strutils proc fixedWidth(input: string, minFieldSize: int):string {.inline.} = # Note that field size is a minimum- will expand field if input # string is larger if input.startsWith("-"): return(input & repeatchar(count=(abs(minFieldSize-len(input))),c=' ')) else: return(" " & input & repeatchar(count=(abs(minFieldSize-len(input))-1),c=' ')) template mathOnInterval(lowbound,highbound:float,counts: int,p:proc) = block: var step: float = (highbound - lowbound)/(max(counts,1)) var current: float = lowbound while current < highbound: echo($fixedWidth($current,25) & ": " & $fixedWidth($p(current),25)) current += step echo "Sine of theta from 0 to 2*PI by PI/12" mathOnInterval(0.0,2.0*PI,12,sin) echo("\n") echo "Cosine of theta from 0 to 2*PI by PI/12" mathOnInterval(0.0,2.0*PI,12,cos) # The first example above is much the same as: # for i in 1..100: # echo($sin( (float(i)/100.0) * 2.0*PI )) rouge-2.2.1/lib/rouge/demos/markdown0000644000175000017500000000016413150713277017243 0ustar uwabamiuwabamiMarkdown has cool [reference links][ref 1] and [regular links too](http://example.com) [ref 1]: http://example.com rouge-2.2.1/lib/rouge/demos/abap0000644000175000017500000000027713150713277016331 0ustar uwabamiuwabamilo_obj ?= lo_obj->do_nothing( 'Char' && ` String` ). SELECT SINGLE * FROM mara INTO ls_mara WHERE matkl EQ '1324'. LOOP AT lt_mara ASSIGNING . CHECK -mtart EQ '0001'. ENDLOOP. rouge-2.2.1/lib/rouge/demos/vb0000644000175000017500000000017013150713277016025 0ustar uwabamiuwabamiPrivate Sub Form_Load() ' Execute a simple message box that says "Hello, World!" MsgBox "Hello, World!" End Sub rouge-2.2.1/lib/rouge/demos/cmake0000644000175000017500000000021713150713277016500 0ustar uwabamiuwabamicmake_minimum_required(VERSION 2.8.3) project(foo C) # some note add_executable(foo utils.c "foo.c") target_link_libraries(foo ${LIBRARIES}) rouge-2.2.1/lib/rouge/demos/liquid0000644000175000017500000000036713150713277016715 0ustar uwabamiuwabami
    {% for product in products %}
  • {{ product.title }}

    Only {{ product.price | format_as_money }}

    {{ product.description | prettyprint | truncate: 200 }}

  • {% endfor %}
rouge-2.2.1/lib/rouge/demos/irb_output0000644000175000017500000000012113150713277017606 0ustar uwabamiuwabamihello world => #> rouge-2.2.1/lib/rouge/demos/igorpro0000644000175000017500000000032713150713277017103 0ustar uwabamiuwabami#pragma TextEncoding = "UTF-8" #pragma rtGlobals=3 // Use modern global access method and strict wave access. Function/WAVE MakeWave(name) String name Make/N=(8,8) root:$name/WAVE=wv = p^2 + q^2 return wv End rouge-2.2.1/lib/rouge/demos/dot0000644000175000017500000000012513150713277016204 0ustar uwabamiuwabami// The graph name and the semicolons are optional graph G { a -- b -- c; b -- d; } rouge-2.2.1/lib/rouge/demos/diff0000644000175000017500000000021013150713277016321 0ustar uwabamiuwabami--- file1 2012-10-16 15:07:58.086886874 +0100 +++ file2 2012-10-16 15:08:07.642887236 +0100 @@ -1,3 +1,3 @@ a b c -d e f +D E F g h i rouge-2.2.1/lib/rouge/demos/sass0000644000175000017500000000007313150713277016371 0ustar uwabamiuwabami@for $i from 1 through 3 .item-#{$i} width: 2em * $i rouge-2.2.1/lib/rouge/demos/lua0000644000175000017500000000032613150713277016202 0ustar uwabamiuwabami-- defines a factorial function function fact (n) if n == 0 then return 1 else return n * fact(n-1) end end print("enter a number:") a = io.read("*number") -- read a number print(fact(a)) rouge-2.2.1/lib/rouge/demos/prolog0000644000175000017500000000035113150713277016721 0ustar uwabamiuwabamidiff(plus(A,B), X, plus(DA, DB)) <= diff(A, X, DA) and diff(B, X, DB). diff(times(A,B), X, plus(times(A, DB), times(DA, B))) <= diff(A, X, DA) and diff(B, X, DB). equal(X, X). diff(X, X, 1). diff(Y, X, 0) <= not equal(Y, X). rouge-2.2.1/lib/rouge/demos/java0000644000175000017500000000016413150713277016342 0ustar uwabamiuwabamipublic class java { public static void main(String[] args) { System.out.println("Hello World"); } } rouge-2.2.1/lib/rouge/demos/xml0000644000175000017500000000011713150713277016217 0ustar uwabamiuwabami rouge-2.2.1/lib/rouge/demos/scss0000644000175000017500000000010613150713277016370 0ustar uwabamiuwabami@for $i from 1 through 3 { .item-#{$i} { width: 2em * $i; } } rouge-2.2.1/lib/rouge/demos/mosel0000644000175000017500000000064313150713277016542 0ustar uwabamiuwabami(!****************************************************** Mosel Example Problems *******************************************************!) ! Objective function: total daily cost Cost:= sum(p in TYPES, t in TIME) (CSTART(p)*start(p,t) + LEN(t)*(CMIN(p)*work(p,t) + CADD(p)*padd(p,t))) ! Limit on power production above minimum level forall(p in TYPES, t in TIME) padd(p,t) <= (PMAX(p)-PMIN(p))*work(p,t) rouge-2.2.1/lib/rouge/demos/irb0000644000175000017500000000015613150713277016176 0ustar uwabamiuwabamiirb(main):001:0> puts "Hello, world!" Hello, world! irb(main):002:0> Object.new => # rouge-2.2.1/lib/rouge/demos/praat0000644000175000017500000000076013150713277016532 0ustar uwabamiuwabamiform Copy selected files... word Prefix word Suffix _copy boolean Keep_original 1 endform total_objects = numberOfSelected() for i to total_objects my_object[i] = selected(i) endfor for i to total_objects selectObject: my_object[i] @copy() new[i] = selected() endfor if total_objects selectObject: new[1] for i from 2 to total_objects plusObject: new[i] endfor endif procedure copy () .name$ = extractWord$(selected$(), " ") Copy: prefix$ + .name$ + suffix$ endproc rouge-2.2.1/lib/rouge/demos/vala0000644000175000017500000000023113150713277016337 0ustar uwabamiuwabamiclass Demo.HelloWorld : GLib.Object { public static int main (String[] args) { stdout.printf("Hello World\n"); return 0; } } rouge-2.2.1/lib/rouge/demos/smarty0000644000175000017500000000040013150713277016731 0ustar uwabamiuwabami{foo bar='single quotes' baz="double quotes" test3=$test3}
    {foreach from=$myvariable item=data}
  • {$data.field}
  • {foreachelse}
  • No Data
  • {/foreach}
{$foo.bar.baz}
rouge-2.2.1/lib/rouge/demos/wollok0000644000175000017500000000025013150713277016724 0ustar uwabamiuwabamiobject pepita { var energy = 100 method energy() = energy method fly(kilometers) { energy -= kilometers + 10 } method sayHi() = "Coo!" } rouge-2.2.1/lib/rouge/demos/sql0000644000175000017500000000005413150713277016216 0ustar uwabamiuwabamiSELECT * FROM `users` WHERE `user`.`id` = 1 rouge-2.2.1/lib/rouge/demos/haml0000644000175000017500000000013013150713277016333 0ustar uwabamiuwabami%section.container %h1= post.title %h2= post.subtitle .content = post.content rouge-2.2.1/lib/rouge/demos/ceylon0000644000175000017500000000024313150713277016710 0ustar uwabamiuwabamishared class CeylonClass() given Parameter satisfies Object { shared String name => "CeylonClass"; } shared void run() => CeylonClass(); rouge-2.2.1/lib/rouge/demos/clojure0000644000175000017500000000013413150713277017061 0ustar uwabamiuwabami(defn make-adder [x] (let [y x] (fn [z] (+ y z)))) (def add2 (make-adder 2)) (add2 4) rouge-2.2.1/lib/rouge/demos/scala0000644000175000017500000000013013150713277016475 0ustar uwabamiuwabamiclass Greeter(name: String = "World") { def sayHi() { println("Hi " + name + "!") } } rouge-2.2.1/lib/rouge/demos/shell0000644000175000017500000000011413150713277016523 0ustar uwabamiuwabami# If not running interactively, don't do anything [[ -z "$PS1" ]] && return rouge-2.2.1/lib/rouge/demos/twig0000644000175000017500000000023213150713277016367 0ustar uwabamiuwabami{% include 'header.html' %} {% for user in users %} * {{ user.name }} {% else %} No users have been found. {% endfor %} {% include 'footer.html' %} rouge-2.2.1/lib/rouge/demos/coq0000644000175000017500000000035613150713277016206 0ustar uwabamiuwabamiRequire Import Coq.Lists.List. Section with_T. Context {T : Type}. Fixpoint length (ls : list T) : nat := match ls with | nil => 0 | _ :: ls => S (length ls) end. End with_T. Definition a_string := "hello \" world".rouge-2.2.1/lib/rouge/demos/objective_c0000644000175000017500000000045713150713277017702 0ustar uwabamiuwabami@interface Person : NSObject { @public NSString *name; @private int age; } @property(copy) NSString *name; @property(readonly) int age; -(id)initWithAge:(int)age; @end NSArray *arrayLiteral = @[@"abc", @1]; NSDictionary *dictLiteral = @{ @"hello": @"world", @"goodbye": @"cruel world" }; rouge-2.2.1/lib/rouge/demos/mxml0000644000175000017500000000114313150713277016374 0ustar uwabamiuwabami rouge-2.2.1/lib/rouge/demos/http0000644000175000017500000000102513150713277016375 0ustar uwabamiuwabamiPOST /demo/submit/ HTTP/1.1 Host: rouge.jneen.net Cache-Control: max-age=0 Origin: http://rouge.jayferd.us User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7 Content-Type: application/json Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Referer: http://pygments.org/ Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: windows-949,utf-8;q=0.7,*;q=0.3 {"name":"test","lang":"text","boring":true} rouge-2.2.1/lib/rouge/demos/console0000644000175000017500000000017113150713277017061 0ustar uwabamiuwabami# prints "hello, world" to the screen ~# echo Hello, World Hello, World # don't run this ~# rm -rf --no-preserve-root / rouge-2.2.1/lib/rouge/demos/idlang0000644000175000017500000000040013150713277016650 0ustar uwabamiuwabamifor i = 99L, 0, -1 do begin print, i, format="(I0, 1X, 'bottles of beer on the wall,')" print, i, format="(I0, 1X, 'bottles of beer.')" print, 'Take one down, pass it around,' print, i, format="(I0, 1X, 'bottles of beer on the wall.', /)" endfor rouge-2.2.1/lib/rouge/demos/python0000644000175000017500000000024413150713277016741 0ustar uwabamiuwabamidef fib(n): # write Fibonacci series up to n """Print a Fibonacci series up to n.""" a, b = 0, 1 while a < n: print a, a, b = b, a+b rouge-2.2.1/lib/rouge/demos/matlab0000644000175000017500000000033113150713277016655 0ustar uwabamiuwabamiA = cat( 3, [1 2 3; 9 8 7; 4 6 5], [0 3 2; 8 8 4; 5 3 5], ... [6 4 7; 6 8 5; 5 4 3]); % The EIG function is applied to each of the horizontal 'slices' of A. for i = 1:3 eig(squeeze(A(i,:,:))) end rouge-2.2.1/lib/rouge/demos/apache0000644000175000017500000000102313150713277016635 0ustar uwabamiuwabamiAddDefaultCharset UTF-8 RewriteEngine On # Serve gzipped version if available and accepted AddEncoding x-gzip .gz RewriteCond %{HTTP:Accept-Encoding} gzip RewriteCond %{REQUEST_FILENAME}.gz -f RewriteRule ^(.*)$ $1.gz [QSA,L] ForceType text/css Header append Vary Accept-Encoding ForceType application/javascript Header append Vary Accept-Encoding ForceType text/html Header append Vary Accept-Encoding rouge-2.2.1/lib/rouge/demos/apiblueprint0000644000175000017500000000141713150713277020121 0ustar uwabamiuwabamiFORMAT: 1A HOST: http://polls.apiblueprint.org/ # Polls Polls is a simple API allowing consumers to view polls and vote in them. # Polls API Root [/] ## Group Question Resources related to questions in the API. ## Question [/questions/{question_id}] + Parameters + question_id: 1 (number, required) - ID of the Question in form of an integer + Attributes + question: `Favourite programming language?` (required) + published_at: `2014-11-11T08:40:51.620Z` - An ISO8601 date when the question was published + choices (array[Choice], required) - An array of Choice objects + url: /questions/1 ### View a Questions Detail [GET] + Response 200 (application/json) + Attributes (Question) ### Delete a Question [DELETE] + Relation: delete + Response 204 rouge-2.2.1/lib/rouge/demos/jinja0000644000175000017500000000026313150713277016514 0ustar uwabamiuwabami{% extends "layout.html" %} {% block body %} {% endblock %} rouge-2.2.1/lib/rouge/demos/plaintext0000644000175000017500000000001613150713277017425 0ustar uwabamiuwabamiplain text :) rouge-2.2.1/lib/rouge/demos/factor0000644000175000017500000000015313150713277016675 0ustar uwabamiuwabamiUSING: io kernel sequences ; 4 iota [ "Happy Birthday " write 2 = "dear NAME" "to You" ? print ] each rouge-2.2.1/lib/rouge/demos/biml0000644000175000017500000000320213150713277016340 0ustar uwabamiuwabami<#@ template language="C#" #> <#@ import namespace="System.Data" #> EXEC usp_StoredProc <# foreach (var table in RootNode.Tables) { #> SELECT * FROM <#=table.Name#> <# } #> rouge-2.2.1/lib/rouge/demos/powershell0000644000175000017500000000224213150713277017604 0ustar uwabamiuwabamiFunction Get-IPv4Scopes <# .SYNOPSIS Read IPv4Scopes from an array of servers .PARAMETER Servers Specifies an array of servers .EXAMPLE Get-IPv4Scopes Will prompt for all inputs #> { [CmdletBinding()] Param( # 1 [parameter( Mandatory=$true, Position=0, ValueFromPipelineByPropertyName=$true, HelpMessage="Server List" )] [string[]]$Servers, #2 [parameter(Mandatory=$false,ValueFromPipeline=$false)] [bool]$Unique=$false ) #EndParam Begin {} Process { $arrayJobs=@() foreach ($server in $Servers) { $arrayJobs+=Invoke-Command -ComputerName $server -scriptblock {Get-DhcpServerv4Scope} -AsJob } $complete=$false while (-not $complete) { $arrayJobsInProgress= $arrayJobs | Where-Object { $_.State -match 'running' } if (-not $arrayJobsInProgress) { $complete=$true } } $Scopes=$arrayJobs|Receive-Job $UniqueScopes=$Scopes|Sort-Object -Property ScopeId -Unique } End { if ($Unique) { return $UniqueScopes } else { return $Scopes } } } #end function rouge-2.2.1/lib/rouge/demos/toml0000644000175000017500000000035213150713277016373 0ustar uwabamiuwabami# This is a TOML document. Boom. title = "TOML Example" [owner] name = "Tom Preston-Werner" organization = "GitHub" bio = "GitHub Cofounder & CEO\nLikes tater tots and beer." dob = 1979-05-27T07:32:00Z # First class dates? Why not? rouge-2.2.1/lib/rouge/demos/llvm0000644000175000017500000000112213150713277016366 0ustar uwabamiuwabami; copied from http://llvm.org/docs/LangRef.html#module-structure ; Declare the string constant as a global constant. @.str = private unnamed_addr constant [13 x i8] c"hello world\0A\00" ; External declaration of the puts function declare i32 @puts(i8* nocapture) nounwind ; Definition of main function define i32 @main() { ; i32()* ; Convert [13 x i8]* to i8 *... %cast210 = getelementptr [13 x i8]* @.str, i64 0, i64 0 ; Call puts function to write out the string to stdout. call i32 @puts(i8* %cast210) ret i32 0 } ; Named metadata !1 = metadata !{i32 42} !foo = !{!1, null} rouge-2.2.1/lib/rouge/demos/literate_haskell0000644000175000017500000000027213150713277020735 0ustar uwabamiuwabamiIn Bird-style you have to leave a blank before the code. > fact :: Integer -> Integer > fact 0 = 1 > fact n = n * fact (n-1) And you have to leave a blank line after the code as well. rouge-2.2.1/lib/rouge/demos/erlang0000644000175000017500000000027613150713277016675 0ustar uwabamiuwabami%%% Geometry module. -module(geometry). -export([area/1]). %% Compute rectangle and circle area. area({rectangle, Width, Ht}) -> Width * Ht; area({circle, R}) -> 3.14159 * R * R.rouge-2.2.1/lib/rouge/demos/lasso0000644000175000017500000000034313150713277016541 0ustar uwabamiuwabami/**! Inserts all of the elements from #rhs into the array. */ define array->+(rhs::trait_forEach) => { local(a = .asCopy); #rhs->forEach => { #a->insert(#1) } return (#a) } define array->onCompare(n::null) => 1 rouge-2.2.1/lib/rouge/demos/groovy0000644000175000017500000000036113150713277016745 0ustar uwabamiuwabamiclass Greet { def name Greet(who) { name = who[0].toUpperCase() + who[1..-1] } def salute() { println "Hello $name!" } } g = new Greet('world') // create object g.salute() // output "Hello World!" rouge-2.2.1/lib/rouge/demos/moonscript0000644000175000017500000000040313150713277017612 0ustar uwabamiuwabamiutil = require "my.module" a_table = { foo: 'bar' interpolated: "foo-#{other.stuff 2 + 3}" "string": 2 do: 'keyword' } class MyClass extends SomeClass new: (@init, arg2 = 'default') => @derived = @init + 2 super! other: => @foo + 2 rouge-2.2.1/lib/rouge/demos/csharp0000644000175000017500000000022513150713277016677 0ustar uwabamiuwabami// reverse byte order (16-bit) public static UInt16 ReverseBytes(UInt16 value) { return (UInt16)((value & 0xFFU) << 8 | (value & 0xFF00U) >> 8); } rouge-2.2.1/lib/rouge/demos/julia0000644000175000017500000000026013150713277016522 0ustar uwabamiuwabamifunction mandel(z) c = z maxiter = 80 for n = 1:maxiter if abs(z) > 2 return n-1 end z = z^2 + c end return maxiter end rouge-2.2.1/lib/rouge/demos/cfscript0000644000175000017500000000054513150713277017241 0ustar uwabamiuwabamicomponent accessors="true" { property type="string" name="firstName" default=""; property string username; function init(){ return this; } public any function submitOrder( required product, coupon="", boolean results=true ){ var foo = function( required string baz, x=true, y=false ){ return "bar!"; }; return foo; } }rouge-2.2.1/lib/rouge/demos/sed0000644000175000017500000000012613150713277016172 0ustar uwabamiuwabami/begin/,/end/ { /begin/n # skip over the line that has "begin" on it s/old/new/ } rouge-2.2.1/lib/rouge/demos/ini0000644000175000017500000000013613150713277016177 0ustar uwabamiuwabami; last modified 1 April 2001 by John Doe [owner] name=John Doe organization=Acme Widgets Inc. rouge-2.2.1/lib/rouge/demos/ruby0000644000175000017500000000016413150713277016402 0ustar uwabamiuwabamiclass Greeter def initialize(name="World") @name = name end def say_hi puts "Hi #{@name}!" end end rouge-2.2.1/lib/rouge/demos/prometheus0000644000175000017500000000037613150713277017621 0ustar uwabamiuwabami"this is a string" 'these are unescaped: \n \\ \t' `these are not unescaped: \n ' " \t` http_requests_total{environment=~"staging|testing|development", method!="GET"} http_requests_total offset 5m sum(http_requests_total{method="GET"}[10m] offset 5m) rouge-2.2.1/lib/rouge/demos/common_lisp0000644000175000017500000000003313150713277017733 0ustar uwabamiuwabami(defun square (x) (* x x)) rouge-2.2.1/lib/rouge/demos/jsonnet0000644000175000017500000000135413150713277017103 0ustar uwabamiuwabami// Compiler template local CCompiler = { cFlags: [], out: "a.out", local flags_str = std.join(" ", self.cFlags), local files_str = std.join(" ", self.files), cmd: "%s %s %s -o %s" % [self.compiler, flags_str, files_str, self.out], }; // GCC specialization local Gcc = CCompiler { compiler: "gcc" }; // Another specialization local Clang = CCompiler { compiler: "clang" }; // Mixins - append flags local Opt = { cFlags: super.cFlags + ["-O3", "-DNDEBUG"] }; local Dbg = { cFlags: super.cFlags + ["-g"] }; // Output: { targets: [ Gcc { files: ["a.c", "b.c"] }, Clang { files: ["test.c"], out: "test" }, Clang + Opt { files: ["test2.c"], out: "test2" }, Gcc + Opt + Dbg { files: ["foo.c", "bar.c"], out: "baz" }, ] } rouge-2.2.1/lib/rouge/demos/gherkin0000644000175000017500000000107213150713277017047 0ustar uwabamiuwabami# language: en Feature: Addition In order to avoid silly mistakes As someone who has trouble with mental math I want to be told the sum of two numbers Scenario Outline: Add two numbers Given I have entered into the calculator And I have entered into the calculator When I press