| Server IP : 104.21.74.147 / Your IP : 216.73.217.154 Web Server : nginx/1.24.0 System : Linux wordpress-sites 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/rebeccaone.com/wp-content/plugins/cornerstone/includes/classes/Vm/Script/ |
Upload File : |
<?php
namespace Themeco\Cornerstone\Vm\Script;
use Themeco\Cornerstone\Parsy\OrderOperations;
use Themeco\Cornerstone\Parsy\LanguageParser;
use Themeco\Cornerstone\Parsy\P;
use Themeco\Cornerstone\Parsy\ParserState;
use Themeco\Cornerstone\Parsy\Util\ParseException;
class ScriptParser implements LanguageParser {
public $grammar;
public $debug;
public function __construct(NanoScript $grammar) {
$this->grammar = $grammar;
}
public function setup() {
$this->grammar->setup($this->debug);
}
public function debug($enabled) {
$this->debug = $enabled;
return $this;
}
public function run( $input, $parser = 'script' ) {
try {
return $this->grammar->{$parser}->run( $input, $this->debug );
} catch (ParseException $e) {
if ($this->debug) {
$this->debugOutput($e);
}
throw new \Exception( $e->getMessage() );
}
}
// @TODO if we want to do this
public function debugOutput($e) {
}
public function compile( $input ) {
return $this->run( $this->cleanInput( $input ) );
}
public function hash( $input ) {
return crc32($input);
}
public function cleanInput( $input ) {
$input = preg_replace('/\/\*(?:.|\n)+?\*\//', '', $input); // multi line comments
$input = preg_replace('/\/\/.*\\n/', '', $input); // single line comments
return preg_replace('/\/\/.*$/', '', $input); // comments leading to end of input
}
}