Page MenuHomeWickedGov Phorge

ShellParser.php
No OneTemporary

Size
507 B
Referenced Files
None
Subscribers
None

ShellParser.php

<?php
namespace Shellbox\ShellParser;
use Wikimedia\WikiPEG\SyntaxError;
/**
* Top-level entry for shell command parsing
*/
class ShellParser {
/**
* Parse a shell command
*
* @param string $command
* @return SyntaxTree
*/
public function parse( string $command ) {
$peg = new PEGParser;
try {
$node = $peg->parse( $command );
} catch ( SyntaxError $e ) {
throw new ShellSyntaxError( $e->getMessage(), $e->location->start, $command );
}
return new SyntaxTree( $node );
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, May 16, 18:59 (4 h, 55 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
57/ed/a875c8623912694a6bc0533ddd95
Default Alt Text
ShellParser.php (507 B)

Event Timeline