Skip to content

Bug in tag/placeholder replacing #1785

@fm-117

Description

@fm-117

Describe the bug
When the source text to replace when executing a REPLACE statement or a COPY WITH REPLACING statement starts or end with a space, the TypeCobol parser fails to identify the text and does not perform the replace operation.
Note that the bug is present when the additional space is either in the tag or in the text to be replaced.

To Reproduce
(Type)Cobol code that cause the bug : (if any)

       identification division.
       program-id. TCOMFL02.
       data division.
       working-storage section.
      
       REPLACE ==:tag:== BY ==name1==.
       01 var-:tag: PIC X.
       REPLACE ==:tag:== BY ==name2==.
       01 var-: tag: PIC X.
       REPLACE ==:tag:== BY ==name3==.
       01 var-:tag : PIC X.
      
       REPLACE ==: tag:== BY ==name4==.
       01 var-:tag: PIC X.
       REPLACE ==: tag:== BY ==name5==.
       01 var-: tag: PIC X.
       REPLACE ==: tag:== BY ==name6==.
       01 var-:tag : PIC X.
      
       REPLACE ==:tag :== BY ==name7==.
       01 var-:tag: PIC X.
       REPLACE ==:tag :== BY ==name8==.
       01 var-: tag: PIC X.
       REPLACE ==:tag :== BY ==name9==.
       01 var-:tag : PIC X.
      
       procedure division.
           display var-name1
           display var-name2
           display var-name3
           display var-name4
           display var-name5
           display var-name6
           display var-name7
           display var-name8
           display var-name9
           goback
           .
       end program TCOMFL02.

Expected behavior
The replace operation should take palcec normally and produce the variables var1-name1, var2-name2, var3-name3 and var4-name4.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions