the whole shebang
This commit is contained in:
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/ClassConst.php
vendored
Normal file
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/ClassConst.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_ClassConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __CLASS__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
58
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/DNumber.php
vendored
Normal file
58
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/DNumber.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property float $value Number value
|
||||
*/
|
||||
class PHPParser_Node_Scalar_DNumber extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a float number scalar node.
|
||||
*
|
||||
* @param float $value Value of the number
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($value = 0.0, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'value' => $value
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a DNUMBER token like PHP would.
|
||||
*
|
||||
* @param string $str A string number
|
||||
*
|
||||
* @return float The parsed number
|
||||
*/
|
||||
public static function parse($str) {
|
||||
// if string contains any of .eE just cast it to float
|
||||
if (false !== strpbrk($str, '.eE')) {
|
||||
return (float) $str;
|
||||
}
|
||||
|
||||
// otherwise it's an integer notation that overflowed into a float
|
||||
// if it starts with 0 it's one of the special integer notations
|
||||
if ('0' === $str[0]) {
|
||||
// hex
|
||||
if ('x' === $str[1] || 'X' === $str[1]) {
|
||||
return hexdec($str);
|
||||
}
|
||||
|
||||
// bin
|
||||
if ('b' === $str[1] || 'B' === $str[1]) {
|
||||
return bindec($str);
|
||||
}
|
||||
|
||||
// oct
|
||||
// substr($str, 0, strcspn($str, '89')) cuts the string at the first invalid digit (8 or 9)
|
||||
// so that only the digits before that are used
|
||||
return octdec(substr($str, 0, strcspn($str, '89')));
|
||||
}
|
||||
|
||||
// dec
|
||||
return (float) $str;
|
||||
}
|
||||
}
|
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/DirConst.php
vendored
Normal file
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/DirConst.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_DirConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __DIR__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
22
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/Encapsed.php
vendored
Normal file
22
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/Encapsed.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property array $parts Encaps list
|
||||
*/
|
||||
class PHPParser_Node_Scalar_Encapsed extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs an encapsed string node.
|
||||
*
|
||||
* @param array $parts Encaps list
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $parts = array(), array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'parts' => $parts
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
}
|
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/FileConst.php
vendored
Normal file
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/FileConst.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_FileConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __FILE__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/FuncConst.php
vendored
Normal file
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/FuncConst.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_FuncConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __FUNCTION__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
55
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/LNumber.php
vendored
Normal file
55
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/LNumber.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property int $value Number value
|
||||
*/
|
||||
class PHPParser_Node_Scalar_LNumber extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs an integer number scalar node.
|
||||
*
|
||||
* @param int $value Value of the number
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($value = 0, array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'value' => $value
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses an LNUMBER token (dec, hex, oct and bin notations) like PHP would.
|
||||
*
|
||||
* @param string $str A string number
|
||||
*
|
||||
* @return int The parsed number
|
||||
*/
|
||||
public static function parse($str) {
|
||||
// handle plain 0 specially
|
||||
if ('0' === $str) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if first char is 0 (and number isn't 0) it's a special syntax
|
||||
if ('0' === $str[0]) {
|
||||
// hex
|
||||
if ('x' === $str[1] || 'X' === $str[1]) {
|
||||
return hexdec($str);
|
||||
}
|
||||
|
||||
// bin
|
||||
if ('b' === $str[1] || 'B' === $str[1]) {
|
||||
return bindec($str);
|
||||
}
|
||||
|
||||
// oct (intval instead of octdec to get proper cutting behavior with malformed numbers)
|
||||
return intval($str, 8);
|
||||
}
|
||||
|
||||
// dec
|
||||
return (int) $str;
|
||||
}
|
||||
}
|
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/LineConst.php
vendored
Normal file
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/LineConst.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_LineConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __LINE__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/MethodConst.php
vendored
Normal file
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/MethodConst.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_MethodConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __METHOD__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/NSConst.php
vendored
Normal file
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/NSConst.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_NSConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __NAMESPACE__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
109
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/String.php
vendored
Normal file
109
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/String.php
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property string $value String value
|
||||
*/
|
||||
class PHPParser_Node_Scalar_String extends PHPParser_Node_Scalar
|
||||
{
|
||||
protected static $replacements = array(
|
||||
'\\' => '\\',
|
||||
'$' => '$',
|
||||
'n' => "\n",
|
||||
'r' => "\r",
|
||||
't' => "\t",
|
||||
'f' => "\f",
|
||||
'v' => "\v",
|
||||
'e' => "\x1B",
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructs a string scalar node.
|
||||
*
|
||||
* @param string $value Value of the string
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct($value = '', array $attributes = array()) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'value' => $value
|
||||
),
|
||||
$attributes
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a string token.
|
||||
*
|
||||
* @param string $str String token content
|
||||
*
|
||||
* @return string The parsed string
|
||||
*/
|
||||
public static function parse($str) {
|
||||
$bLength = 0;
|
||||
if ('b' === $str[0]) {
|
||||
$bLength = 1;
|
||||
}
|
||||
|
||||
if ('\'' === $str[$bLength]) {
|
||||
return str_replace(
|
||||
array('\\\\', '\\\''),
|
||||
array( '\\', '\''),
|
||||
substr($str, $bLength + 1, -1)
|
||||
);
|
||||
} else {
|
||||
return self::parseEscapeSequences(substr($str, $bLength + 1, -1), '"');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses escape sequences in strings (all string types apart from single quoted).
|
||||
*
|
||||
* @param string $str String without quotes
|
||||
* @param null|string $quote Quote type
|
||||
*
|
||||
* @return string String with escape sequences parsed
|
||||
*/
|
||||
public static function parseEscapeSequences($str, $quote) {
|
||||
if (null !== $quote) {
|
||||
$str = str_replace('\\' . $quote, $quote, $str);
|
||||
}
|
||||
|
||||
return preg_replace_callback(
|
||||
'~\\\\([\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3})~',
|
||||
array(__CLASS__, 'parseCallback'),
|
||||
$str
|
||||
);
|
||||
}
|
||||
|
||||
public static function parseCallback($matches) {
|
||||
$str = $matches[1];
|
||||
|
||||
if (isset(self::$replacements[$str])) {
|
||||
return self::$replacements[$str];
|
||||
} elseif ('x' === $str[0] || 'X' === $str[0]) {
|
||||
return chr(hexdec($str));
|
||||
} else {
|
||||
return chr(octdec($str));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a constant doc string.
|
||||
*
|
||||
* @param string $startToken Doc string start token content (<<<SMTHG)
|
||||
* @param string $str String token content
|
||||
*
|
||||
* @return string Parsed string
|
||||
*/
|
||||
public static function parseDocString($startToken, $str) {
|
||||
// strip last newline (thanks tokenizer for sticking it into the string!)
|
||||
$str = preg_replace('~(\r\n|\n|\r)$~', '', $str);
|
||||
|
||||
// nowdoc string
|
||||
if (false !== strpos($startToken, '\'')) {
|
||||
return $str;
|
||||
}
|
||||
|
||||
return self::parseEscapeSequences($str, null);
|
||||
}
|
||||
}
|
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/TraitConst.php
vendored
Normal file
13
vendor/nikic/php-parser/lib/PHPParser/Node/Scalar/TraitConst.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class PHPParser_Node_Scalar_TraitConst extends PHPParser_Node_Scalar
|
||||
{
|
||||
/**
|
||||
* Constructs a __TRAIT__ const node
|
||||
*
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(array $attributes = array()) {
|
||||
parent::__construct(array(), $attributes);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user