finished default parser

This commit is contained in:
2018-04-24 07:19:17 -04:00
parent ff99a0eaaf
commit 8a1c752045
26 changed files with 1757 additions and 6 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace XaiCorp\AbcParser\Domain\Modules\Interpreter\Lexicon;
use Enzyme\Axiom\Atoms\StringAtom;
use XaiCorp\AbcParser\Domain\Atoms\UnsignedIntegerAtom;
use XaiCorp\AbcParser\Domain\Modules\Interpreter\Builder;
use XaiCorp\AbcParser\Domain\Modules\Interpreter\Context;
class Transcriber implements Lex
{
use LineKeyDataTrait;
/**
* @var Builder
*/
protected $builder;
public function __construct(Builder $builder)
{
$this->builder = $builder;
}
/**
* @param Context $context
* @param \Closure $next
* @return mixed
* @throws \Enzyme\Axiom\Exceptions\AtomException
*/
public function handle(Context $context, \Closure $next)
{
$line = $context->current();
list($key, $data) = $this->getKeyDataFromLine($line);
if ($key === 'Z') {
$this->builder->addTranscriber(new StringAtom($data));
}
return $next($context);
}
}