From 497a33a99a3a57c0e7feaa2739e4b499aa6986e0 Mon Sep 17 00:00:00 2001 From: windyboy Date: Mon, 22 Jul 2024 00:01:27 +0800 Subject: [PATCH] refactor: Update regular expression pattern for ARR body parsing The code changes in `config.go` update the regular expression pattern for parsing ARR bodies. The previous pattern did not account for the optional time component in the body. The updated pattern now correctly captures the category, number, SSR, departure, arrival, and time components of the ARR body. This refactor ensures accurate parsing of ARR bodies and improves the overall functionality of the aviation parser. --- internal/config/config.go | 2 +- internal/parsers/aviation_parser.go | 65 ++- internal/parsers/aviation_parser_test.go | 23 +- internal/parsers/ginkgo.report | 513 +++++++++++++++++++++++ 4 files changed, 586 insertions(+), 17 deletions(-) create mode 100644 internal/parsers/ginkgo.report diff --git a/internal/config/config.go b/internal/config/config.go index 2c39207..9764cbe 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -55,7 +55,7 @@ const ( // - ssr: the alphanumeric SSR code // - departure: the four-letter departure airport code // - arrival: the four-letter arrival airport code - arrPatternString = `^\((?P[A-Z]{3})-(?P[A-Z0-9]+)-(?P[A-Z0-9]+)-(?P[A-Z]{4})-(?P[A-Z]{4})\)$` + arrPatternString = `^\((?P[A-Z]{3})\-(?P[A-Z0-9]+)(\-(?P[A-Z]+[0-9]+))?\-(?P[A-Z]{4})\-(?P[A-Z]{4})(?P