Bug #2065
ambiguity in date/decimal literals that is not handled properly by the ProgressLexer
0%
Related issues
History
#1 Updated by Greg Shah about 11 years ago
For details, please see notes 6 and 7 of #2063.
#2 Updated by Greg Shah about 11 years ago
- File date_literals_vs_dec_literals.p added
The following testcase shows the limits of this ambiguity.
From the header:
/* date literals can use a . (and -) as a separator; this can occur in ways that */ /* overlap with decimal usage (the same literal input can be both a date and a */ /* decimal; this testcase explores the limits of this behavior */ /* Months: */ /* can't just specify the month */ /* have to be between 1 and 12 inclusive */ /* can be zero padded, there seems to be no practical limit so this is probably dropped */ /* for literals, is always in the first (leftmost) position, no matter what the SESSION:DATE-FORMAT */ /* Days: */ /* have to be between 1 and the highest day of the corresponding month inclusive */ /* can be zero padded, there seems to be no practical limit so this is probably dropped */ /* for literals, is always in the second (middle if there is a year) position, no matter what the SESSION:DATE-FORMAT */ /* Year: */ /* this is optional */ /* for literals, is always in the third (last) position, no matter what the SESSION:DATE-FORMAT */ /* if present, then the date cannot be confused with a decimal literal, so we aren't testing those cases here */ /* most importantly: these "special" date forms can only be used inside a variable */ /* definition initializer! when encountered in regular code, they are exclusively */ /* treated as decimal literals */
#3 Updated by Greg Shah about 11 years ago
- Target version set to Milestone 4
- File date_literals_vs_dec_literals.p added
- Assignee set to Greg Shah
- File ges_upd20130308a.zip added
Updated version of the testcase plus the prepared fixes which are going into conversion testing now.
The core solution is about disabling date literal processing in these cases of a DIGITS.DIGITS- and always making it a decimal literal. Then in the var def initializer processing, we detect when this is a date var and we rewrite the decimal literals to be date literals.
Please note that this also includes many other fixes for date, num and dec literal processing. Included are improvements to removing zero padding like the 4GL does and better handling of 64-bit literals.
#4 Updated by Greg Shah about 11 years ago
- File ges_upd20130308b.zip added
Fixed a stupid indexing error. Going back into conversion testing.
#5 Updated by Greg Shah about 11 years ago
- File ges_upd20130308c.zip added
Another silly mistake, I didn't properly exclude num literals from the trailing zero removal. This updated version is back in conversion testing. I don't expect further problems.
#6 Updated by Greg Shah about 11 years ago
- File ges_upd20130308d.zip added
- Status changed from New to WIP
How many times am I going to be wrong today? Majic compiled fine with the c update but there are still many unwanted removals of zero padding. This version resolves those cases. It has gone back into conversion testing.
#7 Updated by Greg Shah about 11 years ago
- File ges_upd20130308e.zip added
Final version going through conversion testing now. There was an issue with removal of zeros from the year portion of a date (it affected 1 place in Majic).
#8 Updated by Constantin Asofiei about 11 years ago
Another issue related to dates:
def var d as date init "".
converts to:
date d = ""; /* compiler error !! */
#9 Updated by Greg Shah about 11 years ago
Passed conversion testing and checked in as revision 10269.
I'll handle the date from an empty string next.
#10 Updated by Greg Shah about 11 years ago
- File ges_upd20130308f.zip added
Fix for empty string used as a date var initializer. It is being conversion tested now.
#11 Updated by Greg Shah about 11 years ago
Passed conversion testing and checked in as bzr revision 10272.
#12 Updated by Greg Shah about 11 years ago
- Status changed from WIP to Closed
#13 Updated by Constantin Asofiei about 11 years ago
- File ca_upd20130313g.zip added
- File ca_upd20130312f.zip added
The only remaining problem was with char field initializers, which were not handled (it was parsers fault). The notes 113, 114, 116,199 in #2068:
- CA:
One more issue related to initializers. Following is valid in 4GL:
def temp-table tt1 field f1 as char init 0.
- GES:
The places where we "coerce" incompatible types that are used in initializers are in:
1. progress.g in the initializer_constant rule
2. Variable.booleanManhandle()
- CA:
Actually, there is another place where this is done, for character variables: in fixups/variable_initializers. I've tested the date/int/dec/log/char cases (in both fields and vars) and the only problem was to char fields. The solution is to fix the progress.g's initializer_constant rule, to enclose the literal in quotes, if this is a char and the literal is not string or unknown_val. With this, we can remove the fixups in variable_initializers.
I'm putting this through conversion regression testing.
#14 Updated by Constantin Asofiei about 11 years ago
The update has passed conversion regression testing.
#15 Updated by Greg Shah about 11 years ago
I think the wrong update is posted here.
#16 Updated by Constantin Asofiei about 11 years ago
- File ca_upd20130313f.zip added
Correct, good letter, wrong date. Attached is the good one.
#17 Updated by Constantin Asofiei about 11 years ago
- File deleted (
ca_upd20130312f.zip)
#18 Updated by Greg Shah about 11 years ago
The update looks good. You can check it in and distribute it.
#19 Updated by Constantin Asofiei about 11 years ago
Committed to bzr revision 10285.
#20 Updated by Greg Shah over 7 years ago
- Target version changed from Milestone 4 to Conversion Support for Server Features