Project

General

Profile

6709-rpt.diff

Dănuț Filimon, 11/23/2022 07:29 AM

Download (9.08 KB)

View differences:

new/rules/annotations/annotations.xml 2022-11-23 12:27:10 +0000
265 265
**     VVT 20220913          Prevent unsupported legacy annotations from going to Java code. See #6237.
266 266
**     VVT 20220914          Changes in revs. 14243,14241,14239 temporarily reverted until JUnit runtime
267 267
**                           support is added to client projects.
268
**     DDF 20221123          Added nested_find.rules
268 269
*/
269 270
 -->
270 271
 
......
794 795
   <!-- annotate translatable literals, this must happen after record_field_expansion and screen_buffer -->
795 796
   <rule-set name="annotations/i18n" />
796 797

  
798
   <!-- annotate nested find in for each -->
799
   <rule-set name="annotations/nested_find" />
800
   
797 801
   <!-- this must be at the end (in the following order) -->
798 802
   <rule-set name="annotations/collect_parameters" />
799 803
   <rule-set name="annotations/collect_names" />
new/rules/annotations/nested_find.rules 2022-11-23 12:06:22 +0000
1
<?xml version="1.0"?>
2

  
3
<!-- 
4
/*
5
** Module   : nested_find.rules
6
** Abstract : annotation for nested find in for each
7
**
8
** Copyright (c) 2022, Golden Code Development Corporation.
9
**
10
** _#_ _I_ __Date__ __JPRM__ ____________________________Description_____________________________
11
** 001 DDF 20221123          Created initial version. Creates annotation
12
**                           for nested FIND in FOR EACH.
13
*/
14
 -->
15
<!--
16
** This program is free software: you can redistribute it and/or modify
17
** it under the terms of the GNU Affero General Public License as
18
** published by the Free Software Foundation, either version 3 of the
19
** License, or (at your option) any later version.
20
**
21
** This program is distributed in the hope that it will be useful,
22
** but WITHOUT ANY WARRANTY; without even the implied warranty of
23
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
** GNU Affero General Public License for more details.
25
**
26
** You may find a copy of the GNU Affero GPL version 3 at the following
27
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
28
** 
29
** Additional terms under GNU Affero GPL version 3 section 7:
30
** 
31
**   Under Section 7 of the GNU Affero GPL version 3, the following additional
32
**   terms apply to the works covered under the License.  These additional terms
33
**   are non-permissive additional terms allowed under Section 7 of the GNU
34
**   Affero GPL version 3 and may not be removed by you.
35
** 
36
**   0. Attribution Requirement.
37
** 
38
**     You must preserve all legal notices or author attributions in the covered
39
**     work or Appropriate Legal Notices displayed by works containing the covered
40
**     work.  You may not remove from the covered work any author or developer
41
**     credit already included within the covered work.
42
** 
43
**   1. No License To Use Trademarks.
44
** 
45
**     This license does not grant any license or rights to use the trademarks
46
**     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
47
**     of Golden Code Development Corporation. You are not authorized to use the
48
**     name Golden Code, FWD, or the names of any author or contributor, for
49
**     publicity purposes without written authorization.
50
** 
51
**   2. No Misrepresentation of Affiliation.
52
** 
53
**     You may not represent yourself as Golden Code Development Corporation or FWD.
54
** 
55
**     You may not represent yourself for publicity purposes as associated with
56
**     Golden Code Development Corporation, FWD, or any author or contributor to
57
**     the covered work, without written authorization.
58
** 
59
**   3. No Misrepresentation of Source or Origin.
60
** 
61
**     You may not represent the covered work as solely your work.  All modified
62
**     versions of the covered work must be marked in a reasonable way to make it
63
**     clear that the modified work is not originating from Golden Code Development
64
**     Corporation or FWD.  All modified versions must contain the notices of
65
**     attribution required in this license.
66
-->
67

  
68
<rule-set input="tree">
69

  
70
   <worker class="com.goldencode.p2j.uast.ProgressPatternWorker" namespace="prog" />
71
	
72
   <variable name="walkAst" type="com.goldencode.ast.Aast" />
73
   <variable name="forEachStack" type="java.util.Stack" />
74

  
75
   <init-rules>
76
      <rule> forEachStack = create("java.util.Stack") </rule>
77
   </init-rules>
78

  
79
   <walk-rules>
80
      <!-- add for each schemaname to the stack -->
81
      <rule>type == prog.KW_FOR and this.descendant(1, prog.KW_EACH) and 
82
            this.nextSibling.type == prog.BLOCK
83
         <action>walkAst = this.getImmediateChild(prog.record_phrase, null).getChildAt(0)</action>
84
         <action>forEachStack.push(walkAst.getAnnotation("schemaname"))</action>
85
      </rule>
86
   </walk-rules>
87
	
88
   <ascent-rules>
89
      <!-- if find has any of the specified descendants,
90
           add an annotation when the stack is not empty -->
91
      <rule>type == prog.KW_FIND
92
         <rule>this.descendant(1, prog.KW_FIRST) or
93
               this.descendant(1, prog.KW_LAST) or
94
               this.descendant(1, prog.KW_NEXT) or
95
               this.descendant(1, prog.KW_PREV) or
96
               this.descendant(1, prog.KW_CURRENT) or
97
               this.downPath("RECORD_PHRASE/KW_WHERE")
98
            <rule>forEachStack.size() > 0
99
               <action>putNote("nested_find", true)</action>
100
            </rule>
101
         </rule>
102
      </rule>
103
        
104
      <!-- pop elements from the stack-->
105
      <rule>type == prog.BLOCK and 
106
            this.prevSibling != null and 
107
            this.prevSibling.type == prog.KW_FOR and
108
            this.prevSibling.descendant(1, prog.KW_EACH)
109
         <action>forEachStack.pop()</action>
110
      </rule>
111
   </ascent-rules>
112
	
113
</rule-set>
new/rules/include/report.rules 2022-11-23 11:45:43 +0000
58 58
**         20190710          Added helper to describe an enum reference. 
59 59
** 027 CA  20200428          Describe legacy DEFINE ENUM type.
60 60
** 028 GES 20210702          Fixed broken code in describing lvalues.
61
** 029 DDF 20221123          Added helper functions for checking nested_find annotation 
62
**                           and classifying types of nested finds.
61 63
*/
62 64
 -->
63 65
 
......
3296 3298
         </rule>
3297 3299
      </function>
3298 3300
      
3301
      <!-- check if annotation "nested_find" is present  -->
3302
      <function name="nested_find">
3303
         <parameter name="target"        type="com.goldencode.ast.Aast" />
3304
         <return    name="isNestedFind"  type="java.lang.Boolean" />
3305
         
3306
         <rule>isNestedFind = false</rule>
3307
         <rule>target.isAnnotation("nested_find")
3308
               <action>isNestedFind = true</action>
3309
       	 </rule>
3310
      </function>
3311
      
3312
      <!-- classify type of nested find -->
3313
      <function name="type_nested_find_classify">
3314
         <parameter name="target"        type="com.goldencode.ast.Aast" />
3315
         <return    name="findType"      type="java.lang.String" />
3316
         
3317
         <rule>target.getImmediateChild(prog.KW_FIRST, null) != null
3318
            <action>findType = "FIRST"</action>
3319
         </rule>
3320
         
3321
         <rule>target.getImmediateChild(prog.KW_LAST, null) != null
3322
            <action>findType = "LAST"</action>
3323
         </rule>
3324
         
3325
         <rule>target.getImmediateChild(prog.KW_NEXT, null) != null
3326
            <action>findType = "NEXT"</action>
3327
         </rule>
3328
         
3329
         <rule>target.getImmediateChild(prog.KW_PREV, null) != null
3330
            <action>findType = "PREV"</action>
3331
         </rule>
3332
         
3333
         <rule>target.getImmediateChild(prog.KW_CURRENT, null) != null
3334
            <action>findType = "CURRENT"</action>
3335
         </rule>
3336
         
3337
         <rule>this.downPath("RECORD_PHRASE/KW_WHERE")
3338
            <action>findType = "WHERE"</action>
3339
         </rule>
3340
      </function>
3341
      
3299 3342
  </func-library>
3300 3343
</rule-set>
new/rules/reports/profile.rpt 2022-11-23 11:41:34 +0000
70 70
**         20190715          Added file variants of the .NET reports.
71 71
**     CA  20191023          Added builtin OO method report; improved builtin OO class reports.
72 72
** 036 CA  20200428          Include the enums in duplicate OO names report.
73
** 037 DDF 20221123          Added nested find report. 
73 74
*/
74 75
 -->
75 76
 
......
2415 2416
      dumpType="parser"
2416 2417
      title="Nested CAN-FIND"
2417 2418
      tags="Database"/>
2419
   <report
2420
      condition="evalLib(&quot;nested_find&quot;, this)"
2421
      dumpType="parser"
2422
      multiplexExpr="execLib(&quot;type_nested_find_classify&quot;, this)"
2423
      title="FOR EACH Nested FIND"
2424
      tags="Database"/>
2418 2425
   <report 
2419 2426
      condition="upPath(&quot;KW_FIND/RECORD_PHRASE&quot;) and evalLib(&quot;literals&quot;, type)"
2420 2427
      dumpType="parser"