class Rouge::Lexers::PHP
Public Class Methods
builtins()
click to toggle source
# File lib/rouge/lexers/php.rb, line 49 def self.builtins Kernel::load File.join(Lexers::BASE_DIR, 'php/keywords.rb') builtins end
detect?(text)
click to toggle source
# File lib/rouge/lexers/php.rb, line 29 def self.detect?(text) return true if text.shebang?('php') return false if /^<\?hh/ =~ text return true if /^<\?php/ =~ text end
keywords()
click to toggle source
# File lib/rouge/lexers/php.rb, line 35 def self.keywords @keywords ||= Set.new %w( old_function cfunction __class__ __dir__ __file__ __function__ __halt_compiler __line__ __method__ __namespace__ __trait__ abstract and array as break case catch clone continue declare default die do echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile eval exit extends final finally fn for foreach global goto if implements include include_once instanceof insteadof isset list match new or parent print private protected public readonly require require_once return self static switch throw try unset var while xor yield ) end
new(*)
click to toggle source
Calls superclass method
# File lib/rouge/lexers/php.rb, line 19 def initialize(*) super # if truthy, the lexer starts highlighting with php code # (no <?php required) @start_inline = bool_option(:start_inline) { :guess } @funcnamehighlighting = bool_option(:funcnamehighlighting) { true } @disabledmodules = list_option(:disabledmodules) end
Public Instance Methods
builtins()
click to toggle source
# File lib/rouge/lexers/php.rb, line 54 def builtins return [] unless @funcnamehighlighting @builtins ||= Set.new.tap do |builtins| self.class.builtins.each do |mod, fns| next if @disabledmodules.include? mod builtins.merge(fns) end end end