Module: CodeRay::Scanners::PHP::RE

Defined in:
lib/coderay/scanners/php.rb

Overview

:nodoc:

Constant Summary collapse

PHP_START =
/
  <script\s+[^>]*?language\s*=\s*"php"[^>]*?> |
  <script\s+[^>]*?language\s*=\s*'php'[^>]*?> |
  <\?php\d? |
  <\?(?!xml)
/xi
PHP_END =
%r!
  </script> |
  \?>
!xi
HTML_INDICATOR =
/<!DOCTYPE html|<(?:html|body|div|p)[> ]/i
IDENTIFIER =
'ä'[/[[:alpha:]]/] == 'ä' ? Regexp.new('[[:alpha:]_[^\0-\177]][[:alnum:]_[^\0-\177]]*') : Regexp.new('[a-z_\x7f-\xFF][a-z0-9_\x7f-\xFF]*', true)
VARIABLE =
/\$#{IDENTIFIER}/
OPERATOR =
/
  \.(?!\d)=? |      # dot that is not decimal point, string concatenation
  && | \|\| |       # logic
  :: | -> | => |    # scope, member, dictionary
  \\(?!\n) |        # namespace
  \+\+ | -- |       # increment, decrement
  [,;?:()\[\]{}] |  # simple delimiters
  [-+*\/%&|^]=? |   # ordinary math, binary logic, assignment shortcuts
  [~$] |            # whatever
  =& |              # reference assignment
  [=!]=?=? | <> |   # comparison and assignment
  <<=? | >>=? | [<>]=?  # comparison and shift
/x