classSourcePosition
final class SourcePosition
Public API: explicitly declared with
@visibility public.A line and column in SQL text, both counted from one.
$position = \SqlParser\Lexer\SourcePosition::at("SELECT 1\nFROM t", 12);
[$position->line, $position->column] // => [2, 4]Properties§
public int $linepublic int $columnMethods§
public function __construct(public int $line, public int $column)Parameters
$line | int | Line number counted from one |
$column | int | Byte column counted from one |
public static function at(string $source, int $offset): selfLocates a byte offset in a text.
Parameters
$source | string | The text |
$offset | int | Byte offset, clamped to the text's length |
Returns
self The positionTest cases 2
Called from 4
- static-call SqlParser\Lexer\LexicalException::unterminated() packages/sql-parser/src/Lexer/LexicalException.php:30
- static-call SqlParser\Lexer\LexicalException::unexpectedCharacter() packages/sql-parser/src/Lexer/LexicalException.php:45
- static-call SqlParser\Lexer\LexicalException::unknownTerminal() packages/sql-parser/src/Lexer/LexicalException.php:63
- static-call SqlParser\Parser\SyntaxException::__construct() packages/sql-parser/src/Parser/SyntaxException.php:34
Test cases 27§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 25
LexicalExceptionTestcallsSourceExceptionTestcallsTerminalIndexTestcallsMySqlLexerTestcallsOperatorScannerTestcallsQuotedScannerTestcallsTriviaScannerTestcallsVariableScannerTestcallsWordScannerTestcallsMySqlParserTestcallsLrParserTestcallsSyntaxExceptionTestcallsLookaheadFilterTestcallsNumberScannerTestcallsOperatorScannerTestcallsPostgreSqlLexerTestcallsQuotedScannerTestcallsTriviaScannerTestcallsPostgreSqlParserTestcallsNumberScannerTestcallsOperatorScannerTestcallsQuotedScannerTestcallsSqliteLexerTestcallsVariableScannerTestcallsSqliteParserTestcalls
Relations§
Static calls 4
- static-call SqlParser\Lexer\LexicalException::unterminated() packages/sql-parser/src/Lexer/LexicalException.php:30
- static-call SqlParser\Lexer\LexicalException::unexpectedCharacter() packages/sql-parser/src/Lexer/LexicalException.php:45
- static-call SqlParser\Lexer\LexicalException::unknownTerminal() packages/sql-parser/src/Lexer/LexicalException.php:63
- static-call SqlParser\Parser\SyntaxException::__construct() packages/sql-parser/src/Parser/SyntaxException.php:34