refactor: Add DLA message parsing logic to BodyParser
This commit is contained in:
@@ -100,6 +100,8 @@ const (
|
||||
fplPatternString = `\((?P<category>[A-Z]{3})-(?P<number>[A-Z]+\d+)-(?P<indicator>[A-Z]{2})\n-(?P<aircraft>[A-Z]+\d+\/?[A-Z]?)\n?-(?P<surve>.*)\n?-(?P<departure>[A-Z]{4})(?P<departure_time>\d{4})\n?-(?P<speed>[A-Z]+\d+)(?P<level>[A-Z0-9]+)\s+(?P<route>(.|\n)+)\n-(?P<destination>[A-Z]{4})(?P<estt>\d{4})\s?(?P<alter>(\s[A-Z]{4})+)\n?-([A-Z]{3}\/(?:[A-Z]{4}\d{4}\s?)+)?(?P<other>(?m)[A-Z]{3}\/(.|\n)*)\)$`
|
||||
|
||||
cnlPatternString = `^\((?P<category>[A-Z]{3})-(?P<number>\w+\d+)-?(?P<departure>[A-Z]{4})?-?(?<destination>[A-Z]{4})\)$`
|
||||
|
||||
dlaPatternString = `^\((?P<category>[A-Z]{3})-(?P<number>\w+\d+)-?(?P<departure>[A-Z]{4})(?P<departure_time>\d{4})?-?(?<arrival>[A-Z]{4})(?<arrival_time>\d{4})?\)$`
|
||||
)
|
||||
|
||||
// Initialize the bodyPatterns map
|
||||
@@ -140,6 +142,15 @@ var bodyPatterns = map[string]BodyConfig{
|
||||
},
|
||||
},
|
||||
},
|
||||
"DLA": {
|
||||
Patterns: []PatternConfig{
|
||||
{
|
||||
Pattern: dlaPatternString,
|
||||
Comments: "Pattern for DLA message",
|
||||
Expression: regexp.MustCompile(dlaPatternString),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func GetBodyPatterns() map[string]BodyConfig {
|
||||
|
||||
Reference in New Issue
Block a user