1<?php 2 3declare(strict_types=1); 4 5namespace Antlr\Antlr4\Runtime\Tree; 6 7use Antlr\Antlr4\Runtime\Interval; 8 9/** 10 * A tree that knows about an interval in a token stream 11 * is some kind of syntax tree. Subinterfaces distinguish 12 * between parse trees and other kinds of syntax trees we might want to create. 13 */ 14interface SyntaxTree extends Tree 15{ 16 /** 17 * Return an {@see Interval} indicating the index in the 18 * {@see TokenStream} of the first and last token associated with this 19 * subtree. If this node is a leaf, then the interval represents a single 20 * token and has interval i..i for token index i. 21 * 22 * An interval of i..i-1 indicates an empty interval at position 23 * i in the input stream, where 0 <= i <= the size of the input 24 * token stream. Currently, the code base can only have i=0..n-1 but 25 * in concept one could have an empty interval after EOF. 26 * 27 * If source interval is unknown, this returns {@see Interval::invalid()}. 28 * 29 * As a weird special case, the source interval for rules matched after 30 * EOF is unspecified. 31 */ 32 public function getSourceInterval() : Interval; 33} 34