All Downloads are FREE. Search and download functionalities are using the official Maven repository.

prompto.parser.ILocation Maven / Gradle / Ivy

The newest version!
package prompto.parser;

public interface ILocation {
	
	static ILocation first(ILocation l1, ILocation l2) {
		// assumption is that both locations come from the same parsing
		return l1.getTokenIndex() < l2.getTokenIndex() ? l1 : l2;
	}

	static ILocation last(ILocation l1, ILocation l2) {
		// assumption is that both locations come from the same parsing
		return l1.getTokenIndex() > l2.getTokenIndex() ? l1 : l2;
	}

	int getTokenIndex();
	int getLine();
	int getColumn();
	
	default boolean isNotAfter(ILocation other) {
		return this.getLine()other.getLine()
				|| ( this.getLine()==other.getLine() && this.getColumn()>=other.getColumn() );
			
	}
	

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy