Project

General

Profile

Bug #3316

String 'termin' is not accepted as a name of variable/field.

Added by Jaroslaw Haziak over 6 years ago. Updated over 6 years ago.

Status:
Test
Priority:
Normal
Assignee:
Target version:
-
Start date:
08/11/2017
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:

parser_fix_branch_3293a_revision_11163.txt Magnifier (7.26 KB) Greg Shah, 08/17/2017 05:03 PM


Related issues

Related to Database - Feature #3293: implement metaschema usage from #3257-3 WIP

History

#1 Updated by Jaroslaw Haziak over 6 years ago

String 'termin' is treated by FWD as a abbreviation for ABL function TERMINAL but it should not be.

I guess that in ABL the only valid abbreviation for this function is 'TERM', so 'termin' could be used freely as a field or variable name.
And we use it because it is a polish word frequently used in business.

An example workaround for this bug is to change in progress.p file, the 'min' parameter in Keyword definition for TERMINAL from 4 to 0:
new Keyword("terminal", 4, KW_TERM, true) --> new Keyword("terminal", 0, KW_TERM, true)

This works only when 'term' abbreviation is not used.

#2 Updated by Greg Shah over 6 years ago

The following testcase shows this behavior.

/* TERM is a synonynm for TERMINAL, both are reserved keywords,
   the following will not compile:
def var term     as int.
def var terminal as int.
*/

/* these are valid because there are no abbreviations for TERMINAL */
def var termi    as int.
def var termin   as int.
def var termina  as int.

/* both of these forms are equivalent (term is a synonym for terminal) */
if term     eq "bogus" then message "won't happen".
if terminal eq "bogus" then message "won't happen".

/* terminal does not support abbreviations, the following won't compile:
if termi    eq "bogus" then message "won't happen".
if termin   eq "bogus" then message "won't happen".
if termina  eq "bogus" then message "won't happen".
*/  

Progress sometimes does this. WAIT and WAIT-FOR is another example.

#3 Updated by Greg Shah over 6 years ago

The Progress 4GL reference book has a keyword index which incorrectly states that TERM is the minimum abbreviation for TERMINAL. It also does mention TERM as a separate reserved keyword. So it is only partially wrong.

#4 Updated by Greg Shah over 6 years ago

Here is the error that happens in FWD trunk revision 11158 (and before):

term_is_a_synonym_for_terminal.p
line 9:9: unexpected token: termi
    at com.goldencode.p2j.uast.ProgressParser.symbol(ProgressParser.java:8781)
    at com.goldencode.p2j.uast.ProgressParser.def_var_stmt(ProgressParser.java:10590)
    at com.goldencode.p2j.uast.ProgressParser.define_stmt(ProgressParser.java:9153)
    at com.goldencode.p2j.uast.ProgressParser.stmt_list(ProgressParser.java:22931)
    at com.goldencode.p2j.uast.ProgressParser.statement(ProgressParser.java:6205)
    at com.goldencode.p2j.uast.ProgressParser.single_block(ProgressParser.java:5078)
    at com.goldencode.p2j.uast.ProgressParser.block(ProgressParser.java:4833)
    at com.goldencode.p2j.uast.ProgressParser.external_proc(ProgressParser.java:4760)
    at com.goldencode.p2j.uast.AstGenerator.parse(AstGenerator.java:1440)
    at com.goldencode.p2j.uast.AstGenerator.processFile(AstGenerator.java:939)
    at com.goldencode.p2j.uast.AstGenerator.processFile(AstGenerator.java:811)
    at com.goldencode.p2j.uast.ScanDriver.lambda$scan$0(ScanDriver.java:325)
    at com.goldencode.p2j.uast.ScanDriver.scan(ScanDriver.java:360)
    at com.goldencode.p2j.uast.ScanDriver.scan(ScanDriver.java:199)
    at com.goldencode.p2j.convert.ConversionDriver.runScanDriver(ConversionDriver.java:432)
    at com.goldencode.p2j.convert.ConversionDriver.front(ConversionDriver.java:313)
    at com.goldencode.p2j.convert.ConversionDriver.main(ConversionDriver.java:1885)
Failure in file 'term_is_a_synonym_for_terminal.p':
com.goldencode.ast.AstException: Error processing ./term_is_a_synonym_for_terminal.p
    at com.goldencode.p2j.uast.AstGenerator.processFile(AstGenerator.java:944)
    at com.goldencode.p2j.uast.AstGenerator.processFile(AstGenerator.java:811)
    at com.goldencode.p2j.uast.ScanDriver.lambda$scan$0(ScanDriver.java:325)
    at com.goldencode.p2j.uast.ScanDriver.scan(ScanDriver.java:360)
    at com.goldencode.p2j.uast.ScanDriver.scan(ScanDriver.java:199)
    at com.goldencode.p2j.convert.ConversionDriver.runScanDriver(ConversionDriver.java:432)
    at com.goldencode.p2j.convert.ConversionDriver.front(ConversionDriver.java:313)
    at com.goldencode.p2j.convert.ConversionDriver.main(ConversionDriver.java:1885)
Caused by: java.lang.NullPointerException
    at com.goldencode.p2j.uast.ProgressParser.def_var_stmt(ProgressParser.java:10593)
    at com.goldencode.p2j.uast.ProgressParser.define_stmt(ProgressParser.java:9153)
    at com.goldencode.p2j.uast.ProgressParser.stmt_list(ProgressParser.java:22931)
    at com.goldencode.p2j.uast.ProgressParser.statement(ProgressParser.java:6205)
    at com.goldencode.p2j.uast.ProgressParser.single_block(ProgressParser.java:5078)
    at com.goldencode.p2j.uast.ProgressParser.block(ProgressParser.java:4833)
    at com.goldencode.p2j.uast.ProgressParser.external_proc(ProgressParser.java:4760)
    at com.goldencode.p2j.uast.AstGenerator.parse(AstGenerator.java:1440)
    at com.goldencode.p2j.uast.AstGenerator.processFile(AstGenerator.java:939)
    ... 7 more

#5 Updated by Greg Shah over 6 years ago

Branch 3293a revision 11163 contains the parser fix for this. See the attached file for details.

#6 Updated by Greg Shah over 6 years ago

  • Related to Feature #3293: implement metaschema usage from #3257-3 added

#7 Updated by Greg Shah over 6 years ago

  • Project changed from Bugs to Conversion Tools
  • Assignee set to Greg Shah

#8 Updated by Greg Shah over 6 years ago

  • Status changed from New to Test

#9 Updated by Greg Shah over 6 years ago

Branch 3293a has passed regression testing and was merged to FWD trunk as revision 11160.

Jaroslaw: can you confirm that this patch resolves the issue for you? If so, I will close the issue.

#10 Updated by Greg Shah over 6 years ago

The fix for this task is included in FWD v3.1 which was recently released. Download it from https://proj.goldencode.com/projects/p2j/wiki/FWD_v3_1_0

Please let us know if this issue can be closed.

#11 Updated by Greg Shah over 6 years ago

  • % Done changed from 0 to 100

Also available in: Atom PDF