Is Proparse known to have issues with nested includes and/or 'many preprocessors'?
I have code that compiles fine, but when I try to Prolint it it gives me "unexpected token: return"
on code like:
if not available bPROG_DICT
then do:
/* Program Definition not found */
{lib/message.i &message={lib/msg/msg001}}
return.
end.
When I preprocess the code Prolint/ProParse have no problems.
Is anyone alive in the hive? Anyways can someone please help me with an error I have in joanju_autodox_err.txt. It is "...unexpected token: erSysError". My code is this:
CATCH erSysError AS Progress.Lang.SysError:
RUN ReturnResult (erSysError:GetMessageNum(1),erSysError:GetMessage(1)).
DELETE OBJECT erSysError.
END CATCH.
I try using parserDictAdd("erSysError", "ERROR") but no success. Any suggestions?
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.
This is a sample of how we could implement the colon-t prolint rule:
DEF VAR lv_String AS CHAR NO-UNDO. FOR EACH TTNode NO-LOCK WHERE TTnode.NodeTypeNum EQ NodeTypes:QSTRING#: IF SUBSTR(TTnode.NodeText,LENGTH(TTnode.NodeText) - 1) NE ":T" THEN NEXT. ASSIGN lv_String = SUBSTRING(TTnode.NodeText,2,LENGTH(TTnode.NodeText) - 4). IF LENGTH(TRIM(lv_String)) = LENGTH(lv_String) THEN NEXT. MESSAGE SUBSTITUTE('Line: &1, Column: &2 attrib :T will trim string "&3"',TTnode.NodeLine,TTNode.NodeCol, lv_String) VIEW-AS ALERT-BOX INFORMATION. END.
Once the parseunit has been initialized and the cu parsed, the following is an example of a "missing NO-UNDO" rule:
DEF BUFFER ChildNode FOR TTNode. FOR EACH TTnode WHERE nodetypenum EQ NodeTypes:DEFINE# AND NodeTypenum2 EQ NodeTypes:VARIABLE# NO-LOCK: /* DEFINE and VARIABLE */ IF CAN-FIND(FIRST ChildNode WHERE ChildNode.Parent EQ TTNode.Nodenum AND ChildNode.NodeTypeNum EQ NodeTypes:NOUNDO#) THEN NEXT. /* move to the next DEF VAR */
Has anyone thought about running the API on an appserver process ? I see some advantages in this ..
I'm posting this for my own reference. A few weeks from now I won't remember why.
I've been considering this question: "Why not use the nodeNum in the parent/firstChild/nextSibling/prevSibling fields?"
Well, in very general terms, consider that any Object may reference any other Object. A Block object might reference a Node object. A Symbol object might reference a Node object. A Scope object my reference a Block object. There has to be an extremely general purpose mechanism for any one Object to reference any other Object. That's what the indexNum and index->offset gives us.
For the benefit of both OO and non-OO node manipulation, I am going to add more node properties. As a result, I need to make some changes to some property names.
The current property list is
Txt CHAR FirstChildNum INT NextSiblingNum INT PrevSiblingNum INT TypeNum INT IndexNum INT ParentNum INT FileNum INT LineNum INT ColumnNum INT RecordOffSet INT Type CLASS NodeType FirstChild CLASS node NextSibling CLASS node PrevSibling CLASS node Parent CLASS node
Does anyone have any objection to making nodetypes a static class ? The properties of each node type are gathered from the proparse server once. As a node class needs to determine the node type characteristics, we currently have to pass around the parseunit object so that the node can do
DEF PUBLIC PROPERTY Type AS CLASS NodeType NO-UNDO GET(): RETURN parseUnit:proparse:NodeTypes:Item(TypeNum). END GET . PROTECTED SET .
I would prefer to see
DEF PUBLIC PROPERTY Type AS CLASS NodeType NO-UNDO GET():
With the latest version of proparse trunk, we can now use the proparse OO Api to talk with the proparse.jar server. See classclient.p for demos on how to load projects and parse files. We need people to test and play with this to find the holes, and make suggestions, so please roll up your sleeves and get busy !