LEXICAL_ORDER property

Comparator<AstNode> LEXICAL_ORDER
getter/setter pair

A comparator that can be used to sort AST nodes in lexical order.

In other words, compare will return a negative value if the offset of the first node is less than the offset of the second node, zero (0) if the nodes have the same offset, and a positive value if the offset of the first node is greater than the offset of the second node.

Implementation

static Comparator<AstNode> LEXICAL_ORDER =
    (AstNode first, AstNode second) => first.offset - second.offset;