Library Reference
#include "coord.h"
typedef POSITION *CoordPtr;
POSITION NoCoord;
CoordPtr NoPosition;
int LineOf(POSITION);
int ColOf(POSITION);
int RLineOf(POSITION);
int RColOf(POSITION);
int LineNum;
POSITION curpos;
int earlier(CoordPtr p, CoordPtr q)
This module implements a source text coordinate system for an abstract
syntax tree.
A value of type POSITION attached to an abstract syntax tree node
locates the source text phrase that is represented by that node.
By default, the value specifies the coordinates of the first character of the
phrase as a pair (line index, column index).
LineOf and ColOf are access functions for the elements of the
pair; they may be used either to read or to set these elements.
If the C pre-processor symbol RIGHTCOORD is defined, each
POSITION value additionally specifies the coordinates of the first
character beyond the source text phrase represented by the node.
The access functions for the additional elements are RLineOf and
RColOf .
LineNum and curpos are variables provided by the coordinate
module for the use of its clients.
LineNum initially has the value 1.
It is neither read nor set by the coordinate module.
The initial value of curpos is undefined, and it is also neither
read nor set by the coordinate module.
The earlier function is called to compare two positions.
If p precedes q in the source text then
earlier returns the value 1 ;
otherwise earlier returns the value 0 .
When the C pre-processor symbol RIGHTCOORD is defined,
earlier returns 1 if phrase p precedes phrase
q and the two do not overlap.
|