Package net.hydromatic.morel.ast
Class Pos
- java.lang.Object
-
- net.hydromatic.morel.ast.Pos
-
public class Pos extends java.lang.ObjectPosition of a parse-tree node.
-
-
Constructor Summary
Constructors Constructor Description Pos(int startLine, int startColumn, int endLine, int endColumn)Creates a Pos.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)inthashCode()Posplus(Pos pos)PosplusAll(java.lang.Iterable<Pos> poses)PosplusAll(java.util.List<? extends AstNode> nodes)static <E> Possum(java.lang.Iterable<E> elements, java.util.function.Function<E,Pos> fn)static Possum(java.lang.Iterable<Pos> poses)Combines an iterable of parser positions to create a position which spans from the beginning of the first to the end of the last.private static Possum(java.lang.Iterable<Pos> poses, int line, int column, int endLine, int endColumn)Computes the parser position which is the sum of an array of parser positions and of a parser position represented by (line, column, endLine, endColumn).static Possum(java.util.List<? extends AstNode> nodes)private static Possum_(java.util.List<Pos> positions)Combines a list of parser positions to create a position which spans from the beginning of the first to the end of the last.java.lang.StringtoString()
-
-
-
Field Detail
-
ZERO
public static final Pos ZERO
-
startLine
public final int startLine
-
startColumn
public final int startColumn
-
endLine
public final int endLine
-
endColumn
public final int endColumn
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
sum
public static Pos sum(java.lang.Iterable<Pos> poses)
Combines an iterable of parser positions to create a position which spans from the beginning of the first to the end of the last.
-
sum
public static <E> Pos sum(java.lang.Iterable<E> elements, java.util.function.Function<E,Pos> fn)
-
sum_
private static Pos sum_(java.util.List<Pos> positions)
Combines a list of parser positions to create a position which spans from the beginning of the first to the end of the last.
-
sum
private static Pos sum(java.lang.Iterable<Pos> poses, int line, int column, int endLine, int endColumn)
Computes the parser position which is the sum of an array of parser positions and of a parser position represented by (line, column, endLine, endColumn).- Parameters:
poses- Array of parser positionsline- Start linecolumn- Start columnendLine- End lineendColumn- End column- Returns:
- Sum of parser positions
-
-