While trying to understand the relation between AirSigmetObsOrForecast and SigmetForecastAt classes, I started to wonder, could there be a simpler solution. We need to keep in mind that we're working at lexeme level: only recognizing patterns and related data types without further semantics, like order of appearance or value validity. From that perspective, it might be simpler to remove SigmetForecastAt visitor and SIGMET_FCST_AT identity, and use this AirSigmetObsOrForecast visitor and OBS_OR_FORECAST identity only.
This way the visitor method could be simplified significantly, as checks for previous tokens could be dropped. The parser would be then correctly responsible of the correct usage.
Of course, in reconstructor, we would need to figure out what model property we would need to access to read the possible timestamp. It seems to me that we can infer it simply by looking at whether the analysisIndex or forecastIndex reconstructor context parameter exists.
While trying to understand the relation between
AirSigmetObsOrForecast
andSigmetForecastAt
classes, I started to wonder, could there be a simpler solution. We need to keep in mind that we're working at lexeme level: only recognizing patterns and related data types without further semantics, like order of appearance or value validity. From that perspective, it might be simpler to removeSigmetForecastAt
visitor andSIGMET_FCST_AT
identity, and use thisAirSigmetObsOrForecast
visitor andOBS_OR_FORECAST
identity only.This way the visitor method could be simplified significantly, as checks for previous tokens could be dropped. The parser would be then correctly responsible of the correct usage.
Of course, in reconstructor, we would need to figure out what model property we would need to access to read the possible timestamp. It seems to me that we can infer it simply by looking at whether the
analysisIndex
orforecastIndex
reconstructor context parameter exists._Originally posted by @petringo in https://github.com/fmidev/fmi-avi-messageconverter-tac/pull/117#discussion_r990941013_