Another prolint rule: EndType

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.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

another version, without the

another version, without the ParentNode buffer:

 DEF VAR lv_Txt AS CHAR NO-UNDO.
 
 FOR EACH TTNode NO-LOCK WHERE TTnode.NodeTypeNum EQ NodeTypes:END# AND TTnode.FirstChild EQ -1:
  ASSIGN lv_txt = ParseUnit:Node(TTnode.Nodenum):PARENT:Txt.
  IF NOT CAN-DO("PROCEDURE,FUNCTION,CASE,METHOD,CLASS,CONSTRUCTOR,DESTRUCTOR":U,lv_txt) THEN NEXT. /* ignore DO: FOR: etc */
  MESSAGE SUBSTITUTE('Line: &1, Column: &2 Use END &3 to terminate a &4 block',TTnode.NodeLine,TTNode.NodeCol,lv_Txt,LC(lv_Txt))
          VIEW-AS ALERT-BOX INFORMATION.
 END.

this shows how we can combine the TTNode record with the node objects. We first get the node object from the TTNode nod num,

ParseUnit:Node(TTnode.Nodenum)

then get the parent node of that node

:Parent

and then get the node text of the parent

:txt

This works equally well for the FirstChild, NextSibling, and PrevSibling nodes