Project

General

Profile

Bug #10569

Semicolon is skipped while preprocessing

Added by Radu Apetrii 10 months ago. Updated 5 months ago.

Status:
Internal Test
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
reviewer:
production:
No
env_name:
topics:
4GL Preprocessor

OE_string_highlighting.png (2.65 KB) Octavian Adrian Gavril, 12/15/2025 02:34 AM


Related issues

Related to Conversion Tools - Bug #9903: alternative codings with ' (quote) don't convert to ` (backtick) Internal Test
Related to Testing - Support #6859: preprocessor tests Test
Related to Conversion Tools - Bug #10988: Extra quote is not generated during preprocessing when alternative for two quotes/apostrophes is used. New

History

#1 Updated by Radu Apetrii 10 months ago

Take a look at the following 4GL example.

start.w:

def var a as char initial "".
a = 'text1'~'text2~'text3~';'.
message a.

The second line, when executing the COMPILE PREPROCESS statement in the 4GL environment, is:

a = 'text1'~''text2~'text3~';'.

The same line in .w.cache with trunk is:

a = 'text1'~'text2~'text3~''.

The same line in .w.cache with 6859b is:

a = 'text1'~'text2~'text3~'`.

The thing that is causing issues in the environment I am testing is the missing semicolon (with both trunk and 6859b), but as it can be seen before text2, there is also a double quote/apostrophe in 4GL.

#3 Updated by Radu Apetrii 10 months ago

  • Related to Bug #9903: alternative codings with ' (quote) don't convert to ` (backtick) added

#4 Updated by Radu Apetrii 10 months ago

#5 Updated by Alexandru Lungu 10 months ago

a = 'text1'~'text2~'text3~'`.

I think this is a regression from #6859 :/ The trailing back tick shouldn't be there.

PS: #9903 may be the culprit

#6 Updated by Radu Apetrii 10 months ago

Alex/Danut: if you don't plan on assigning this issue to somebody from your team, can you please suggest a place where I should start investigating? I'm interested in solving the semicolon thing: a semicolon disappears when going from .w to .w.cache (note #10569-1). Thank you!

#7 Updated by Dănuț Filimon 10 months ago

Radu Apetrii wrote:

Alex/Danut: if you don't plan on assigning this issue to somebody from your team, can you please suggest a place where I should start investigating? I'm interested in solving the semicolon thing: a semicolon disappears when going from .w to .w.cache (note #10569-1). Thank you!

I think you can start from src/com/goldencode/p2j/preproc/text.g.

#8 Updated by Radu Apetrii 9 months ago

  • Assignee set to Radu Apetrii
  • Status changed from New to Review
  • % Done changed from 0 to 100

This is the patch I used to solve the issue. Both the testcases and the application scenario are fine with it. Interestingly enough, this happened in just one place in the application.

=== modified file 'src/com/goldencode/p2j/preproc/text.g'
--- old/src/com/goldencode/p2j/preproc/text.g    2025-09-07 09:18:48 +0000
+++ new/src/com/goldencode/p2j/preproc/text.g    2025-10-17 07:36:16 +0000
@@ -194,6 +194,7 @@
 **                           dictionaries, so 'processKey' is no longer needed.
 ** 035 FER 20250806          Added an option in QSTRING rule to allow the ("~") sequence inside a string.
 **                           This is a known quirk in 4GL.
+** 036 RAA 20251017          Added single and double quote in the CODE stop characters section. Refs: #10569
 */

 /*
@@ -1669,6 +1670,8 @@
                    | '&'
                    | '/' 
                    | '*'
+                   | '\''
+                   | '\"'
                    | '(' 
                    | ')' 
                    | '[' 

Basically, I added the single and double quote as part of the stop characters for the CODE section. I added both because, in the example from note 1, if one replaces the single quotes with the double quotes, the problem persists. Now, let me try to explain what this change does.

Before the change, 'text1'~'text2~'text3~';' was treated as 'text1' (STRING) + ~'text2~'text3~';' (CODE). The CODE section began when ~ was encountered, and because it didn't identify any stop character, it went through to the end of the sequence. If I understand correctly, when that CODE piece gets interpreted, it is not considered a valid sequence, and while panicking, it removes the semicolon (automatically?) to make it valid.

After the change, the CODE section is composed only of ~, because the next character, ', is seen as a stop one. The rest is seen as a string. Overall, the sequence is 'text1' (STRING) + ~ (CODE) + 'text2~'text3~';' (STRING). No more invalid sequences means no more panicking.

Greg, if you're ok with this approach, I will commit the change to 6506b.

#9 Updated by Greg Shah 9 months ago

I don't think this change is OK. I deliberately excluded those chars from that rule (i.e. // it is OK to match " or ' as the 2nd or later char).

It seems to me that the 4GL is not implementing the alternative coding in this case, but we are implementing it. It is not clear why this is the case. I also don't understand why the 4GL generates an extra ' before text2. That doesn't make sense. We need to understand why the 4GL does these things.

#10 Updated by Greg Shah 9 months ago

To be a bit more clear: we have applications that use a 4GL quirk where ' and " characters can be embedded inside symbol names/arbitrary text. In those cases, these quotes are not part of string literals. This is why the characters are matched at that location in text.g. See the malformed_symbol rule in progress.g.

#11 Updated by Radu Apetrii 9 months ago

  • % Done changed from 100 to 40
  • Status changed from Review to WIP

I'll switch this back to WIP so that we know I'm back to digging.

#12 Updated by Greg Shah 8 months ago

  • Assignee changed from Radu Apetrii to Octavian Adrian Gavril

#13 Updated by Octavian Adrian Gavril 8 months ago

I think the work should be done in 6859b, is that right?

#14 Updated by Greg Shah 8 months ago

Yes, that would probably be for the best.

#15 Updated by Octavian Adrian Gavril 8 months ago

  • Status changed from WIP to Review
  • % Done changed from 40 to 100

Apparently, in 4GL you can write two single/double quotes and the compiler will keep only one. 4GL seems to generate an extra '/" when it's used in this 'doubled up' quotes scenario. Probably it's a hint that ~' will be turn into ' and the new string will be '', which generates an escaped single quote. I don't think we need to reproduce that hint. It will require an extra processing.

If we run COMPILE PREPROCESS with this code:

def var a as char initial "".
a = 'text1'~'text2'.
message a.
the output will be:
def var a as char initial "".
a = 'text1'~''text2'.
message a.

If we do the same for this code:
def var a as char initial "".
a = 'text1'~047text2'.
message a.
the output will be:
def var a as char initial "".
a = 'text1'~047'text2'.
message a.

For both testcases, the value of a is text1'text2. All of these are in OE.

This is supported in FWD and it's handled in character.progressToJavaString. However, the current implementation is translating 'text1'~'text2' as 'text1'(ASTRING) + ~'text2(CODE). The same with double quotes ". That's what is happening for 'text1'~'text2~'text3~';' as well. That's the root cause of this task. ~'text2~'text3~'; is CODE and when ;' is processed in ClearStream, it looks like is not in a STRING. So, it ends up to be translated in ` (backtick).

I've committed the fix for this issue in 6859b/16144. I allowed '~' in ASTRING rule in order to make 'text1'~'text2~'text3~';' an ASTRING. I did the same for QSTRING, even though there is no alternative coding that uses double quote so that wouldn't be a problem. The change from QSTRING is for consistency only.

#16 Updated by Octavian Adrian Gavril 8 months ago

  • reviewer Greg Shah added

Greg, please review the changes.

#17 Updated by Greg Shah 8 months ago

  • Status changed from Review to Internal Test

Code Review Task Branch 6859b Revision 16144

This is really good.

#18 Updated by Octavian Adrian Gavril 8 months ago

The changes fix the testcase mentioned in #10569-1.

Radu, can you check if that's happening for your specific file as well?

#19 Updated by Radu Apetrii 8 months ago

Octavian Adrian Gavril wrote:

Radu, can you check if that's happening for your specific file as well?

Yes, I'll write a note here when I have the results.

#20 Updated by Greg Shah 8 months ago

Please make sure that these cases have been added to the Preprocessor Testcases (unit tests).

All of the unit tests should now pass?

#21 Updated by Radu Apetrii 8 months ago

Radu Apetrii wrote:

Octavian Adrian Gavril wrote:

Radu, can you check if that's happening for your specific file as well?

Yes, I'll write a note here when I have the results.

Indeed, the problem is solved. ✅

#22 Updated by Octavian Adrian Gavril 8 months ago

  • % Done changed from 100 to 90
  • Status changed from Internal Test to WIP

Unfortunately, there are 10 extra tests from alternative_coding_test_set which failed with 6859b/16144. I need to investigate why is that.

#23 Updated by Octavian Adrian Gavril 8 months ago

The cause of failing is this scenario:

"analyze-suspend"~;

The new rule tries to match "~" but "~; is found. The main reason is the corresponding java code of that rule from TextLexer:
            else if ((LA(1)=='"') && (LA(2)=='~')) {
                match("\"~\"");
            }

It's not checking for LA(3) value.

#24 Updated by Octavian Adrian Gavril 8 months ago

  • Status changed from WIP to Review
  • % Done changed from 90 to 100
I've committed new changes that completes the initial fix:
  • I added an extra check for LA(3) to avoid any exception when we do match (I tried with k = 3 for the lexer, but the generated code was the same as in #10569-23).
  • Then, I had to set the inQSTRING/inASTRING properly because we added a third character to be checked in our rule but the started character had inQSTRING = true. This way, the duplication was propagated to the next char.
    I used to get this "analyze-suspend"~;&&ANALYZE-RESUME instead of this "analyze-suspend"~;;&ANALYZE-RESUME.
    So, I added and extra check if we have a quote followed by a tilde in ClearStream.read(). This process is a little too specific, but so is the scenario.

The changes are in 6859b/16145. I retested the preproccesor tests and the results match what is documented in Preprocessor Testcases - Current Status. The initial testcase is still fixed.

Greg, please review the latest changes.

#25 Updated by Octavian Adrian Gavril 8 months ago

  • % Done changed from 100 to 90

I started to add new tests in Preprocessor Testcases but I found that we already have these cases in tests/conversion/preprocessor/support/preprocessor_basic.p. Before the changes related to this task, these were the differences:

--- cvt/tests/conversion/preprocessor/support/preprocessor_basic.p.preproc    2025-12-05 15:26:13.530855864 +0200
+++ tests/conversion/preprocessor/support/baseline/preprocessor_basic.p.preproc    2025-12-04 09:47:11.937890529 +0200
@@ -125,8 +125,8 @@
 // te@[]^`{|}~st

-a = 'text1'~'text2~''text3~''`.
-a = 'text1'~'text2~''text3~'''.
-a = 'text1'~'text2~''text3~''`.
-a = 'text1'~'text2~''text3~'';`.
-a = 'text1'~'text2~''text3~''`.
+a = 'text1'~''text2~'text3~';'.
+a = 'text1'~''text2~'text3~''.
+a = 'text1'~''text2~'text3~';'.
+a = 'text1'~''text2~'text3~';`.
+a = 'text1'~'text2~'text3~'`.

Now, the preprocessor_basic.p is still not fixed by the latest changes. Here are the new differences:

--- cvt/tests/conversion/preprocessor/support/preprocessor_basic.p.preproc    2025-12-05 15:47:29.235199956 +0200
+++ tests/conversion/preprocessor/support/baseline/preprocessor_basic.p.preproc    2025-12-04 09:47:11.937890529 +0200
@@ -125,8 +125,8 @@
 // te@[]^`{|}~st

-a = 'text1'~'text2~'text3~';'.
-a = 'text1'~'text2~'text3~''.
-a = 'text1'~'text2~'text3~';'.
-a = 'text1'~'text2~'text3~';`.
-a = 'text1'~''text2~''text3~''`.
+a = 'text1'~''text2~'text3~';'.
+a = 'text1'~''text2~'text3~''.
+a = 'text1'~''text2~'text3~';'.
+a = 'text1'~''text2~'text3~';`.
+a = 'text1'~'text2~'text3~'`.

So, the reason is that we don't generate an extra '.

#26 Updated by Greg Shah 8 months ago

  • Status changed from Review to WIP

#27 Updated by Octavian Adrian Gavril 8 months ago

  • % Done changed from 90 to 100
  • Status changed from WIP to Review

I changed the % Done by mistake. The issue of this task is fixed. And the preprocessor tests have the same status as before changes.

So, it can stay in review status if there is no problem with the proposed solution.

#28 Updated by Octavian Adrian Gavril 8 months ago

I did some experiments that add an extra ' as OE does, but this changed how the lexer process next input. For example, an extra ' after 'test1'~' would close the ASTRING and text2~'text3~';'. would be CODE.

Since the preprocessor tests are stable, is the current fix sufficient for this task?

#29 Updated by Greg Shah 7 months ago

  • Status changed from Review to Internal Test

Code Review Task Branch 6859b Revision 16145

The changes are good.

Since the preprocessor tests are stable, is the current fix sufficient for this task?

Yes, create a new task for the remaining issue.

#30 Updated by Octavian Adrian Gavril 7 months ago

  • Related to Bug #10988: Extra quote is not generated during preprocessing when alternative for two quotes/apostrophes is used. added

#31 Updated by Octavian Adrian Gavril 7 months ago

What extra testing is needed for this issue? Should we run conversion of some apps?

#32 Updated by Greg Shah 7 months ago

We can take this approach:

  1. Run the front end on an application. Confirm there are no errors.
  2. Compare the .cache files with the trunk version. Confirm there are no unexpected differences.
  3. If there are no cache file differences at all, then we don't need to test that application further. If there are any differences (even expected ones), then we should test full conversion and compare the source output to that generated by trunk. If there are no unexpected differences, the application is OK.

We should test with all major applications.

#33 Updated by Octavian Adrian Gavril 7 months ago

Greg Shah wrote:

We can take this approach:

  1. Run the front end on an application. Confirm there are no errors.
  2. Compare the .cache files with the trunk version. Confirm there are no unexpected differences.
  3. If there are no cache file differences at all, then we don't need to test that application further. If there are any differences (even expected ones), then we should test full conversion and compare the source output to that generated by trunk. If there are no unexpected differences, the application is OK.

We should test with all major applications.

Sure. I'm on it.

#34 Updated by Octavian Adrian Gavril 7 months ago

This approach should test only the changes related to this task or it should include all the changes from 6859b? If we test 6859b/rev16145, then I expect to see differences caused by other changes as well.

#35 Updated by Greg Shah 7 months ago

I described the testing for all of 6859b. You can document that in #6859 itself. I don't see a reason to do separate testing by each subtask. The overall testing is enough (when combined with passing the unit tests).

#36 Updated by Octavian Adrian Gavril 7 months ago

I noticed some suspect differences for ChUI regression testing app:

   <customer_code_redacted>

It's somehow a regression. This is the problematic syntax "|"+string(operskil.routing,">>>>9")+"|" . It seems like ~n is treated as in non-string environment due to missing white-spaces between +.

But this syntax is not compiling in OE:

def var a as char.
a = "a".
a = "|"+a+"|" + "~n".

It's weird that with/without my changes, that file is converted successfully. But the previous testcase is not:

main.p:4:3: unexpected char: 0xFFFF
     [java]     at com.goldencode.p2j.preproc.TextLexer.nextToken(TextLexer.java:265)
     [java]     at antlr.TokenBuffer.fill(TokenBuffer.java:69)

#37 Updated by Octavian Adrian Gavril 7 months ago

  • Status changed from Internal Test to WIP
  • % Done changed from 100 to 90

Actually, only the last revision of 6859b is triggering this issue with concatenation operator. I think this should be fixed here, so I'm moving this task back to WIP.

#38 Updated by Octavian Adrian Gavril 7 months ago

The tricky zone is here: +"|" + "~n"..
  • +"| is CODE
  • " + " is a QSTRING. This way, the new line will be translated and the next code will be broken because of my last changes that set the 'in string' flag to false when we have "~n.

The expected result should be:

              +"|" + "~n".
             /  |   \  \
            /   |    |  \ 
           /    |    |   \
          V     V    V    V
       CODE QSTRING CODE QSTRING

#39 Updated by Octavian Adrian Gavril 7 months ago

Greg, do you recall why is it OK to match " or ' as the 2nd or later char in CODE? I used these changes and there are no differences for both my testcase and syman/dc/so-labr1.w, comparing the trunk with 6859b.

=== modified file 'src/com/goldencode/p2j/preproc/text.g'
--- old/src/com/goldencode/p2j/preproc/text.g    2025-12-05 12:41:56 +0000
+++ new/src/com/goldencode/p2j/preproc/text.g    2025-12-11 12:39:16 +0000
@@ -1797,6 +1797,8 @@
                 // it is OK to match " or ' as the 2nd or later char
                 ~(
                      ' '
                    | '\t'
                    | '\n'
                    | '&'
                    | '/' 
+                   | '\"'
+                   | '\''
                    | '*'
                    | '(' 
                    | ')' 

#40 Updated by Octavian Adrian Gavril 7 months ago

I used changes above and ChUI regression app converted and there were no differences. But a preprocessor test failed and this is the testcase:

def var txt as char.

txt = "txt"~;'.
txt = 'txt'~;'.

Preprocessor output in OE:

def var txt as char.

txt = "txt"~;;'.
txt = 'txt'~;;'.

Preprocessor output in FWD:

def var txt as char.

txt = "txt"~;;'.
txt = 'txt'~;'.

The FWD output is intuitively correct because the second ~; is considered inside of string. Therefore, we don't duplicate ;:

txt = "txt"~; '.
txt = '
txt '~;'.

The fact is that OE is highlighting the code in the same way. So in theory, we don't expect the second ~; to be duplicated, but it does.

txt = "txt"~;;'.      <----  Maybe ;' is interpreted as `
txt = 'txt'~;;'.      <----  Then the string will be 'txt', no '~;'. So the ; gets duplicated

I don't know a better explanation for this behavior.

Here is another testcase. Please see the highlighting:

Preprocessor output in OE:

def var txt as char.

txt = "txt"~;;'.
txt = 'txt'~;;'.

txt = "txt"~;;'.'
txt = 'txt'~;'.

Look at the second ~;. We know that ; is duplicated just when we are outside of strings. But here the behavior is backwards. When is highlight as a string, ; gets duplicated. Otherwise, it doesn't.

#41 Updated by Octavian Adrian Gavril 7 months ago

Could this be a reason why using ' or " as CODE is allowed on trunk?

#42 Updated by Octavian Adrian Gavril 7 months ago

Here is another testcase:

def var txt as char.

txt = "txt"~; ".
txt = "txt"~;".

txt = "a" +"b ~; ".

Preprocessor output in OE:

def var txt as char.

txt = "txt"~;; ".         <--- last quote open a string literal
txt = "txt"~;".           <--- ; is not duplicated so we are in a string

txt = "a" +"b ~;; ".      <--- ; is duplicated because we are not in a string due to missing white space before quote

It looks like we can open a string only if the quote/apostrophe is preceded by white space. So, I really think that it is OK to consume " or ' as the second or later char from CODE. Therefore, the changes mentioned in #10569-39 are incorrect. We should find another way to fix the issue described in #10569-36.

#43 Updated by Greg Shah 7 months ago

Greg, do you recall why is it OK to match " or ' as the 2nd or later char in CODE?

I don't recall exactly but I do think the ChUI regression app issue would be one of the cases. I do remember having to write that code explicitly while working on some other applications, so it will probably be found elsewhere too.

Please make sure to add all of these testcases into our ABLUnit preproc test set.

#44 Updated by Greg Shah 7 months ago

It looks like we can open a string only if the quote/apostrophe is preceded by white space. So, I really think that it is OK to consume " or ' as the second or later char from CODE.

Good find.

Also: My understanding is that the highlighting in the Progress IDE may be written as a one-off IDE-specific parser and is not the same code that implements the COMPILE in OE. So: the highlighting might be different than the compiler would accept.

#45 Updated by Octavian Adrian Gavril 7 months ago

Look at this testcase:

def var txt as char.

txt = "txt"~; ".
txt = "txt"~; "."    // not duplicated

txt = "txt"~; ".
txt = "txt"a~; "."   // not duplicated

txt = "txt"~; ".
txt = "txt" 
~; "."  // duplicated because is preceded by new line

txt = "txt"~; ".
txt = "txt" ~; "."   // duplicated

txt = "txt"~; ".
txt = "txt"|~; "."   // duplicated

Preprocessor output in OE:

def var txt as char.

txt = "txt"~;; ".
txt = "txt"~; "."    // not duplicated

txt = "txt"~;; ".
txt = "txt"a~; "."   // not duplicated

txt = "txt"~;; ".
txt = "txt" 
~;; "."  // duplicated because is preceded by new line

txt = "txt"~;; ".
txt = "txt" ~;; "."   // duplicated

txt = "txt"~;; ".
txt = "txt"|~;; "."   // duplicated

While checking the testcases mentioned in #10569,in #10569-40 and #10569-42, I noticed that the ; is duplicated only if tilde is the first character of our CODE rule. Basically, this happens only when it's preceded by non-consumed characters from the CODE rule:

          ~(
                 ' '
               | '\t'
               | '\n'
               | '&'
               | '/'
               | '(' 
               | ')'
               | '['
               | ']'
               | ',' 
               | '=' 
               | '<' 
               | '>'
               | '{'
               | '}'
               | '|'
           )

So, I think the right way to handle this in FWD is to allow the doubling only in the CODE rule, and only if it starts with a tilde ~. This avoids inside strings duplicates of ; (QSTRING and ASTRING) and matches how the OE preprocessor works.

#46 Updated by Greg Shah 7 months ago

This seems reasonable.

#47 Updated by Octavian Adrian Gavril 7 months ago

  • Status changed from WIP to Review
I've committed new changes into 6859b/16327. These include the following:
  • Fixed concatenation operator +. Before these changes, this sequence +"a" was processed as a CODE and a was considered outside of strings. This way, special characters were processed, like new line, instead of being escaped and kept for the string content. Now, we don't allow quotes in the CODE rule if those are preceded by +. So, for +"a", + will be CODE and "a" will be a QSTRING. Please see #10569-36.
  • Doubled semicolon when we have ~;. I added this processing directly in the grammar in order to follow what OE preprocessor does.
  • Added . as a code chunk broker. I noticed this behavior during experimenting with testcases related to doubled semicolon by tilde.

I tested the original testcase of this task and it's still fixed. I run incremental conversion for ChUI regression testing application and the problematic file is fixed now. I added the preprocessor tests mentioned in the notes above and rerun the preprocessor tests (see #6859-133). The results showed no regression compared to current status.

Greg, please review the latest changes.

#48 Updated by Octavian Adrian Gavril 7 months ago

  • % Done changed from 90 to 100

#49 Updated by Greg Shah 5 months ago

Code Review Task Branch 6859b Revision 16327

1. The changes to CODE seem like they might fix the +"a" case but would fail in the + "a" case (with intervening whitespace between the + and the string). Have you tested that?

2. The // it is OK to match " or ' as the 2nd or later char comment in that CODE rule is no longer accurate.

3. Shouldn't the changes in ClearStream.read() be limited only to the ~; case (which is the specific case where ; gets duplicated)?

#50 Updated by Octavian Adrian Gavril 5 months ago

Greg Shah wrote:

Code Review Task Branch 6859b Revision 16327

1. The changes to CODE seem like they might fix the +"a" case but would fail in the + "a" case (with intervening whitespace between the + and the string). Have you tested that?

In that case, CODE rule will be stopped by the first whitespace and the quote will open the STRING rule. So, I think it's safe. This testcase is converted successfully:

def var a as char.
a = "|" +      "A" + "|" + "~n".
MESSAGE a.

2. The // it is OK to match " or ' as the 2nd or later char comment in that CODE rule is no longer accurate.

You're right.

3. Shouldn't the changes in ClearStream.read() be limited only to the ~; case (which is the specific case where ; gets duplicated)?

They are limited only to the ~; case because env.tildeMode is 2 when the previous character was ~. So, the character x in the sequence ~x is duplicated only if x is not a semicolon ;.

#51 Updated by Greg Shah 5 months ago

1. The changes to CODE seem like they might fix the +"a" case but would fail in the + "a" case (with intervening whitespace between the + and the string). Have you tested that?

In that case, CODE rule will be stopped by the first whitespace and the quote will open the STRING rule. So, I think it's safe. This testcase is converted successfully:
[...]

Good. Please add this testcase and also variants that use ' and which mix " and '. Also, work with Radu to include his testcase from #6506-156 as well as variants that use ' and which mix " and '.

3. Shouldn't the changes in ClearStream.read() be limited only to the ~; case (which is the specific case where ; gets duplicated)?

They are limited only to the ~; case because env.tildeMode is 2 when the previous character was ~. So, the character x in the sequence ~x is duplicated only if x is not a semicolon ;.

OK, please enhance the comment there to make this obvious.

#52 Updated by Greg Shah 5 months ago

  • Status changed from Review to Internal Test

#53 Updated by Octavian Adrian Gavril 5 months ago

Greg Shah wrote:

Good. Please add this testcase and also variants that use ' and which mix " and '. Also, work with Radu to include his testcase from #6506-156 as well as variants that use ' and which mix " and '.

Sure!

OK, please enhance the comment there to make this obvious.

I fixed code comments in 6859b/16328.

#54 Updated by Octavian Adrian Gavril 5 months ago

  • % Done changed from 100 to 90
  • Status changed from Internal Test to WIP

Conversion for a multi-tenant app failed... This is the testcase:

This is the error:

     [java] com.goldencode.ast.AstException: Error processing ./abl/start.p
     [java]     at com.goldencode.p2j.uast.AstGenerator.processFile(AstGenerator.java:1090)
     [java]     at com.goldencode.p2j.uast.ScanDriver.lambda$scan$0(ScanDriver.java:469)
     [java]     at com.goldencode.p2j.uast.ScanDriver.scan(ScanDriver.java:509)
     [java]     at com.goldencode.p2j.uast.ScanDriver.scan(ScanDriver.java:318)
     [java]     at com.goldencode.p2j.convert.TransformDriver.runScanDriver(TransformDriver.java:445)
     [java]     at com.goldencode.p2j.convert.TransformDriver.front(TransformDriver.java:301)
     [java]     at com.goldencode.p2j.convert.TransformDriver.executeJob(TransformDriver.java:1234)
     [java]     at com.goldencode.p2j.convert.ConversionDriver.main(ConversionDriver.java:1301)
     [java] Caused by: line 19:1: expecting '*', found ' '
     [java]     at com.goldencode.p2j.uast.ProgressLexer.nextToken(ProgressLexer.java:3555)
     [java]     at com.goldencode.p2j.uast.LexerDumpFilter.nextToken(LexerDumpFilter.java:262)
     [java]     at antlr.TokenStreamHiddenTokenFilter.consume(TokenStreamHiddenTokenFilter.java:38)
     [java]     at antlr.TokenStreamHiddenTokenFilter.nextToken(TokenStreamHiddenTokenFilter.java:148)
     [java]     at com.goldencode.ast.ManagedHiddenStreamTokenFilter.nextToken(ManagedHiddenStreamTokenFilter.java:99)
     [java]     at antlr.TokenBuffer.fill(TokenBuffer.java:69)
     [java]     at antlr.TokenBuffer.LA(TokenBuffer.java:80)
     [java]     at antlr.LLkParser.LA(LLkParser.java:52)
     [java]     at com.goldencode.p2j.uast.ProgressParser.lvalue(ProgressParser.java:19707)

I think the root cause could be how we process this code run err{&name}.p. or this one /{&comui}* */. I'm investigating the problem.

#55 Updated by Greg Shah 5 months ago

  • topics 4GL Preprocessor added

#56 Updated by Octavian Adrian Gavril 5 months ago

  • % Done changed from 90 to 100
  • Status changed from WIP to Review

I fixed the issue described in #10569-54. The problem was that the isMarker flag wasn't set for all branches of the CODE rule. Before changes, there was only a single rule branch for the 'second or later character' in the CODE. This way, the flag was set properly.

The initial fix for this task split the rule into three cases, which caused the isMarker flag to only be set for the first one. I’ve now added the flag update to all branches. I considered grouping these cases for elegance, but that would have forced ANTLR to generate a default 'else' branch that throws an exception, which we need to avoid. I also experimented with predicates to handle quotes after a '+', but it introduced lexical nondeterminism warnings, so I stuck with this more stable structure.

The changes can be found in 6859b/16454. This revision successfully converts the problematic file from the multi-tenant application. It fixes the testcases from #10569-54 and the preprocessor tests are fine.

Greg, please review.

#57 Updated by Greg Shah 5 months ago

  • Status changed from Review to Internal Test

Code Review Task Branch 6859b Revision 16454

The change looks good.

Also available in: Atom PDF