BashGrammar.php
<?php
namespace Tlf\Lexer;
/**
*
* This is not for actual parsing yet. This is for design work. The $directives array & 'php_open' and 'namespace' are design aspects I'm interested in implementing at some point... maybe
*/
class BashGrammar extends Grammar {
// use Bash\LanguageDirectives;
use Bash\OtherDirectives;
protected $expect = ['html', 'php_open'];
/**
* Filled by traits
*/
protected $directives;
public $notin = [
'asfdasdfkeyword'=>[
// 'match'=>'/this-regex-available on php.net keywords page/',
'__halt_compiler', 'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', 'extends', 'final', 'for', 'foreach', 'function', 'global', 'goto', 'if', 'implements', 'include', 'include_once', 'instanceof', 'insteadof', 'interface', 'isset', 'list', 'namespace', 'new', 'or', 'print', 'private', 'protected', 'public', 'require', 'require_once', 'return', 'static', 'switch', 'throw', 'trait', 'try', 'unset', 'use', 'var', 'while', 'xor'
],
];
public function getNamespace(){return 'bashgrammar';}
public function __construct(){
$this->directives = array_merge(
// $this->_language_directives,
$this->_other_directives,
);
}
public function onLexerStart($lexer,$file,$token){
// $lexer->addDirective($this->getDirectives(':bash')['php_open']);
}
}