Proparse Group



datetime variable with initial now doesn't parse (unexpected token)

line:

define variable dtDatumVanaf as datetime no-undo initial now.

does not parse, unexpected token now.


trim function in preprocessor directive

When trim is used in the expression in a preprocessor directive parsing crashes with an unknown exception.
Sample code:
1.p:

{c:\temp\1.i " "}

1.i:

&if trim("{1}") = ""
&then
find first _user no-lock no-error.
&endif

The problem is in passing an "empty" unnamed preprocessor. In the example when you delete the empty preprocessor in 1.p it parses just fine. I know the trim in 1.i is not necessary, if I remove that it parses just fine. If I change "trim" to "string" in 1.i it parses just fine.


"absolute" linenumber

Is there a way to get an "absolute" linenumber as opposed to the "relative" linenumber from parserGetNodeLine?
In stead of "line 3 in include something.i" I would like to have line 103 since the include was coded on line 100 of the .p
Is this posible?


Procedurename with number and @

I know it is kinda far fetched, but... I was testing the Prolint nameconv rule.
So I had a procedure name like 1ip_pp-1-&-%#$@ and it gave me an unexpected token error.
Turns out proparse can't parse this when it has a number and @ in it and there is no space between the name and the colon.
See attached file.


Proparse.jar build 1049

I posted proparse.jar build 1049 to http://www.joanju.com/proparse/ . This build adds early (alpha) support for 10.1C and 10.2A syntax.


Proparse 10.2 syntax support

Proparse has not been updated since 10.1B, so both 10.1C and 10.2A new language features need to be added.

This page serves as a checklist and to encourage input.


unexpected token: return

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.


unexpected token: erSysError

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?


Another prolint rule: ColonT

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.

prolint example rule using the new API

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 */

Proparse and appserver

Has anyone thought about running the API on an appserver process ? I see some advantages in this ..


Why indexNum instead of nodeNum?

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.


renamed node properties

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


Make nodetypes class static

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():

Proparse API now talks to proparse.jar

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 !


#
Syndicate content