Consultor Eletrônico



Kbase P140474: Preprocess file raises syntax errors when source file contains strings with two single quotes
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   29/01/2009
Status: Unverified

SYMPTOM(s):

Preprocess file raises syntax errors when source file contains strings with two single quotes

Various syntax errors or other misleading errors can occur depending on the code

** Unable to understand after -- "<string>". (247)

** Unknown Field or Variable name - <field-name>. (201)

** Missing FOR, FIND or CREATE for a table with <field> in current block. (232)

The following example illustrates the issue:

String aimed to be displayed on the screen:
The Future's Watching

Source code:
DISPLAY 'The Future''s Watching'.

Preprocessed file:
DISPLAY 'The Future's Watching'.

FACT(s) (Environment):

The single quote (') encloses character constants or strings
Source file contains string with two single quotes ('')
Two single quotes ('') are used for inserting single quotes within a quoted string
Source file compiles with no error
Preprocess file generated with the PREPROCESS option of the COMPILE statement
Progress 9.x
OpenEdge 10.x
All Supported Operating Systems

CAUSE:

Bug# OE00167265


CAUSE:

To use single quotes (') within a quoted string, you must be able to use two single quotes ('') which compiles to a single quote ('), or you must put a tilde (~) in front of any single quote (') within the quoted character string.
However, when using the two single quotes (''), the compiler will compile the two single quotes ('') to a single quote (') within the preprocess file.

This is not correct: the conversion should be made during the final compilation. The fix for the current bug will address this behavior.

FIX:

As a workaround, put a tilde (~) in front of any quote within the quoted character string. In other words use the tilde-double quote combination (~') in replacement of the two single quotes ('') to insert single quotes (') into a character string.