示例#1
0
文件: Lexer.php 项目: phn-io/dal
 /**
  * Constructor.
  *
  * @param TemplateLexer $lexer
  */
 public function __construct(TemplateLexer $lexer)
 {
     $this->templateLexer = $lexer;
     parent::__construct([new WhitespaceRule(), new CommentRule()], [new RegexRule('/' . preg_quote('<{', '/') . '/A', Token::TYPE_OPEN_TAG | Token::TYPE_SYMBOL, true, true), new RegexRule('/' . preg_quote('}>', '/') . '/A', Token::TYPE_CLOSE_TAG | Token::TYPE_SYMBOL, true, true), new SymbolRule(['->', '.', ';', ':', ',', '*', '#', '{', '}', '[', ']', '(', ')', '=', '\\']), new KeywordRule(['support', 'import', 'from', 'export', 'type', 'extends', 'new', 'as', 'function', 'template']), new ConstantRule(['null', 'true', 'false']), new SingleQuotedStringRule(), new DoubleQuotedStringRule(), new BackQuotedStringRule(), new NumberRule(), new IdentifierRule()]);
 }