
@c snarfed from guile.c:187
@deffn {Scheme Procedure} grecs-node? obj
Returns @samp{#t} if @var{obj} is a valid tree node.
@end deffn

@c snarfed from guile.c:197
@deffn {Scheme Procedure} grecs-node-root node
Returns the topmost node that can be traced up from @var{node}.
@end deffn

@c snarfed from guile.c:222
@deffn {Scheme Procedure} grecs-node-head node
Returns the first node having the same parent and located on the same nesting level as @var{node}.  I.e. the following always holds true:

@lisp
(let ((head (grecs-node-head node)))
  (and
    (eq? (grecs-node-up node) (grecs-node-up head))
    (not (grecs-node-prev? head))))
@end lisp

@end deffn

@c snarfed from guile.c:248
@deffn {Scheme Procedure} grecs-node-tail node
Returns the last node having the same parent and located on the same nesting level as node.  In other words, the following relation is always @samp{#t}:

@lisp
(let ((tail (grecs-node-tail node)))
  (and
    (eq? (grecs-node-up node) (grecs-node-up tail))
         (not (grecs-node-next? tail))))
@end lisp

@end deffn

@c snarfed from guile.c:265
@deffn {Scheme Procedure} grecs-node-up? node
Return true if @var{node} has a parent node.
@end deffn

@c snarfed from guile.c:279
@deffn {Scheme Procedure} grecs-node-up node
Return parent node of @var{node}.
@end deffn

@c snarfed from guile.c:293
@deffn {Scheme Procedure} grecs-node-down? node
Returns @samp{#t} if @var{node} has child nodes.
@end deffn

@c snarfed from guile.c:307
@deffn {Scheme Procedure} grecs-node-down node
Returns the first child node of @var{node}.
@end deffn

@c snarfed from guile.c:322
@deffn {Scheme Procedure} grecs-node-next? node
Returns @samp{#t} if @var{node} is followed by another node on the same nesting level.

@end deffn

@c snarfed from guile.c:336
@deffn {Scheme Procedure} grecs-node-next node
Returns the node following @var{node} on the same nesting level.
@end deffn

@c snarfed from guile.c:351
@deffn {Scheme Procedure} grecs-node-prev? node
Returns @samp{#t} if @var{node} is preceded by another node on the same
nesting level.

@end deffn

@c snarfed from guile.c:365
@deffn {Scheme Procedure} grecs-node-prev node
Returns the node preceding @var{node} on the same nesting level.

@end deffn

@c snarfed from guile.c:379
@deffn {Scheme Procedure} grecs-node-ident node
Returns identifier of the node @var{node}.
@end deffn

@c snarfed from guile.c:404
@deffn {Scheme Procedure} grecs-node-ident-locus node [full]
Returns locus of the @var{node}'s identifier.  Returned value is a cons
whose parts depend on @var{full}, which is a boolean value.  If @var{full}
is @samp{#f}, which is the default, then returned value is a cons:

@lisp
(@var{file-name} . @var{line-number})
@end lisp

Oherwise, if @var{full} is @samp{#t}, the function returns the locations
where the node begins and ends:
@lisp
((@var{beg-file-name} @var{beg-line} @var{beg-column}) . 
 (@var{end-file-name} @var{end-line} @var{end-column}))
@end lisp

@end deffn

@c snarfed from guile.c:435
@deffn {Scheme Procedure} grecs-node-path-list node
Returns the full path to the node, converted to a list. Each list element corresponds to a subnode identifier.  A subnode which has a tag is represented by a cons, whose car contains the subnode identifier, and cdr its value.  For example, the following path:

@example
.foo.bar=x.baz
@end example

@noindent
is represented as

@lisp
'("foo" ("bar" . "x") "baz")
@end lisp

@end deffn

@c snarfed from guile.c:485
@deffn {Scheme Procedure} grecs-node-path node [delim]
Returns the full path to the @var{node} (a string).
@end deffn

@c snarfed from guile.c:533
@deffn {Scheme Procedure} grecs-node-type node
Returns the type of the node.  The following constants are defined:

@table @asis
@cindex grecs-node-root
@item grecs-node-root
The node is a root node.  The following is always @samp{#t}:

@lisp
(and (= (grecs-node-type node) grecs-node-root)
     (not (grecs-node-up? node))
     (not (grecs-node-prev? node)))
@end lisp
@cindex grecs-node-stmt
@item grecs-node-stmt
The node is a simple statement.  The following is always @samp{#t}:

@lisp
(and (= (grecs-node-type node) grecs-node-stmt)
     (not (grecs-node-down? node)))
@end lisp
@cindex grecs-node-block
@item grecs-node-block
The node is a block statement.
@end table

@end deffn

@c snarfed from guile.c:547
@deffn {Scheme Procedure} grecs-node-has-value? node
Returns @samp{#t} if @var{node} has a value.
@end deffn

@c snarfed from guile.c:612
@deffn {Scheme Procedure} grecs-node-value node
Returns the value of @var{node}.
@end deffn

@c snarfed from guile.c:642
@deffn {Scheme Procedure} grecs-node-value-locus node [full]
Returns locus of the @var{node}'s value.  Returned value is a cons
whose parts depend on @var{full}, which is a boolean value.  If @var{full}
is @samp{#f}, which is the default, then returned value is a cons:

@lisp
(@var{file-name} . @var{line-number})
@end lisp

Oherwise, if @var{full} is @samp{#t}, the function returns the locations
where the node begins and ends:
@lisp
((@var{beg-file-name} @var{beg-line} @var{beg-column}) . 
 (@var{end-file-name} @var{end-line} @var{end-column}))
@end lisp

@end deffn

@c snarfed from guile.c:694
@deffn {Scheme Procedure} grecs-node-locus node [full]
Returns source location of the @var{node}.  Returned value is a cons
whose parts depend on @var{full}, which is a boolean value.  If @var{full}
is @samp{#f}, which is the default, then returned value is a cons:

@lisp
(@var{file-name} . @var{line-number})
@end lisp

Oherwise, if @var{full} is @samp{#t}, the function returns the locations
where the node begins and ends:
@lisp
((@var{beg-file-name} @var{beg-line} @var{beg-column}) . 
 (@var{end-file-name} @var{end-line} @var{end-column}))
@end lisp

@end deffn

@c snarfed from guile.c:714
@deffn {Scheme Procedure} grecs-find-node node path
Returns the first node whose path is @var{path}.  Starts search from @var{node}.
@end deffn

@c snarfed from guile.c:737
@deffn {Scheme Procedure} grecs-match-first node pattern
Returns the first node whose path matches @var{pattern}.  The search is started from @var{node}.

@end deffn

@c snarfed from guile.c:775
@deffn {Scheme Procedure} grecs-match-next node
@var{Node} must be a node returned by a previous call to @code{grecs-match-first} or @samp{grecs-match-next}. The function returns next node matching the initial pattern, or @samp{#f} if no more matches are found.  For example, the following code iterates over all nodes matching @var{pattern}:

@lisp
(define (iterate-nodes root pattern thunk)
  (do ((node (grecs-match-first root pattern)
             (grecs-match-next node)))
      ((not node))
     (thunk node)))
@end lisp

@end deffn
