godber / pds3label

A Python module for parsing PDS 3 labels.
MIT License
0 stars 0 forks source link

Handle sets as Python sets #15

Open godber opened 9 years ago

godber commented 9 years ago

test/data/set1.lbl

PDS_VERSION_ID = PDS3
EMPTY_SET      = {}
SINGLE_SET     = {1.5}
TRIPLE_SET     = {1.5, 2.5, 3.5}
INT_SET        = {1, 2}
FLOAT_SET      = {2.33, 3.4}
STR_SET        = {"one", "two"}
SYM_SET        = {ONE, TWO}
END
godber commented 9 years ago

I have started on this issue but am getting stuck when calling visitChildren inside my implementation of visitSet_value. None is always returned. I've also noticed that there is no visitScalar_value in the ANTLR generated visitor code. The grammar has:

 value
    : scalar_value
    | sequence_value
    | set_value
    | date_time_value
    ;

There are methods for the other values, just not scalar_value??

godber commented 9 years ago

I guess I could modify the grammar to only accept SYMBOL and INTEGER values as outlined by the PDS documentation. Skipping scalar_value entirely.