-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
In ILE RPG, keyword EXTNAME is parsed incorrectly when it has the form EXTNAME('MYFILE':*ALL).
Steps to reproduce
git clone https://github.com/IBM/ibmi-company_system.gitgit checkout c94ca30387de18f0d28af5f5669849c1773cfd76so-- This should output nothing.- Apply the following patch:
diff --git a/qrpglesrc/depts.pgm.sqlrpgle b/qrpglesrc/depts.pgm.sqlrpgle
index 37b5f5c..5d16639 100755
--- a/qrpglesrc/depts.pgm.sqlrpgle
+++ b/qrpglesrc/depts.pgm.sqlrpgle
@@ -54,7 +54,7 @@
*
Dcl-S Index Int(5);
- Dcl-Ds Department ExtName('DEPARTMENT') Alias Qualified;
+ Dcl-Ds Department ExtName('DEPARTMENT':*ALL) Alias Qualified;
End-Ds;
so-- This now outputs:
qrpglesrc/depts.pgm.sqlrpgle:56 - No object found for reference 'DEPARTMENT''
Notice that it's looking for an object named DEPARTMENT', with an extra apostrophe at the end.
Investigation
From a quick search through the code, I believe that the code decoding EXTNAMEs is here:
sourceorbit/cli/src/targets/languages/rpgle.ts
Lines 256 to 261 in 401b1ed
| const value = trimQuotes(keyword[`EXTNAME`]); | |
| return { | |
| lookup: value.split(`:`)[0].toUpperCase(), | |
| line: struct.position ? struct.position.range.line : undefined | |
| }; |
We can see that it's trimming quotes first, then splitting on semicolons. However, it ought to split on semicolons first, then trim quotes on the first part.
Furthermore, it might be necessary to trim spaces both before and after trimming quotes. (The ILE RPG compiler treats EXTNAME( 'MYFILE ' : *ALL ) the same as EXTNAME('MYFILE':*ALL)).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels