This is getting so easy ;)
DEF BUFFER ParentNode FOR TTNode. FOR EACH TTNode NO-LOCK WHERE TTnode.NodeTypeNum EQ NodeTypes:END# AND TTnode.FirstChild EQ -1, FIRST ParentNode WHERE ParentNode.NodeNum EQ TTnode.Parent NO-LOCK: IF NOT CAN-DO("PROCEDURE,FUNCTION,CASE,METHOD,CLASS,CONSTRUCTOR,DESTRUCTOR":U,ParentNode.NodeText) THEN NEXT. /* ignore DO: FOR: etc */ MESSAGE SUBSTITUTE('Line: &1, Column: &2 Use END &3 to terminate a &4 block',TTnode.NodeLine,TTNode.NodeCol,ParentNode.NodeText,LC(ParentNode.NodeText)) VIEW-AS ALERT-BOX INFORMATION. END.
another version, without the
another version, without the ParentNode buffer:
this shows how we can combine the TTNode record with the node objects. We first get the node object from the TTNode nod num,
then get the parent node of that node
and then get the node text of the parent
This works equally well for the FirstChild, NextSibling, and PrevSibling nodes