Open andrewemeryanz opened 4 years ago
@marcelocantos Could you comment on the correctness of this statement:
The following is the list of officially supported parenthetical primitive type constraints and their expected representation:
decimal(4.8) # primitive: DECIMAL, constraint: { precision: 4, scale: 8 } string(4) # primitive: STRING, constraint: { length: { max: 4 } } string(4..8) # primitive: STRING, constraint: { length: { min: 4, max: 8 } }
Also, should we consider supporting the bitWidth
constraint (from this issue) as the general approach to numeric types? For example, the representation of the following types would be (taking into considering their currently parsed values):
decimal(4) # primitive: DECIMAL, constraint: { bitWidth: 4, length: { max: 4 } }
int(4) # primitive: INT, constraint: { bitWidth: 4, length: { max: 4 } }
float(4) # primitive: FLOAT, constraint: { bitWidth: 4 }
Purpose
Following on from this comment, the Sysl parser currently parses parenthetical primitive constraints that have never been officially supported. Consider the following examples of types that parse correctly but have never been officially supported:
The following is the list of officially supported parenthetical primitive type constraints and their expected representation:
All other representations should be considered invalid.
Suggested approaches
The corpus of Sysl files should first be searched to see if any of the unsupported representations are being used. The parser should then either fail or warn when an unsupported representation is discovered (depending on how widely the representation can be found in use).