1*37748cd8SNickeau<?php 2*37748cd8SNickeau 3*37748cd8SNickeaudeclare(strict_types=1); 4*37748cd8SNickeau 5*37748cd8SNickeaunamespace Antlr\Antlr4\Runtime; 6*37748cd8SNickeau 7*37748cd8SNickeauuse Antlr\Antlr4\Runtime\Utils\Pair; 8*37748cd8SNickeau 9*37748cd8SNickeau/** 10*37748cd8SNickeau * The default mechanism for creating tokens. It's used by default in Lexer and 11*37748cd8SNickeau * the error handling strategy (to create missing tokens). Notifying the parser 12*37748cd8SNickeau * of a new factory means that it notifies its token source and error strategy. 13*37748cd8SNickeau */ 14*37748cd8SNickeauinterface TokenFactory 15*37748cd8SNickeau{ 16*37748cd8SNickeau /** 17*37748cd8SNickeau * This is the method used to create tokens in the lexer and in 18*37748cd8SNickeau * the error handling strategy. If `text !== null`, than the start and stop 19*37748cd8SNickeau * positions are wiped to -1 in the text override is set in the CommonToken. 20*37748cd8SNickeau */ 21*37748cd8SNickeau public function createEx( 22*37748cd8SNickeau Pair $source, 23*37748cd8SNickeau int $type, 24*37748cd8SNickeau ?string $text, 25*37748cd8SNickeau int $channel, 26*37748cd8SNickeau int $start, 27*37748cd8SNickeau int $stop, 28*37748cd8SNickeau int $line, 29*37748cd8SNickeau int $charPositionInLine 30*37748cd8SNickeau ) : Token; 31*37748cd8SNickeau 32*37748cd8SNickeau /** 33*37748cd8SNickeau * Generically useful. 34*37748cd8SNickeau */ 35*37748cd8SNickeau public function create(int $type, string $text) : Token; 36*37748cd8SNickeau} 37