adding RST procesing

pull/2/head
Jean-Marc MEESSEN 4 years ago
parent debe727339
commit 6cef57acba

@ -55,9 +55,10 @@ func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg
//TODO: input null protection?
//Flag telling that we are processing data to the right of the callsign
//isRightOfCall := false
isRightOfCall := false
//TODO: Make something more intelligent
//TODO: What happens if we have partial lines
previousLine.Call = ""
previousLine.RSTsent = ""
previousLine.RSTrcvd = ""
@ -116,27 +117,30 @@ func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg
callErrorMsg := ""
logLine.Call, callErrorMsg = ValidateCall(element)
errorMsg = errorMsg + callErrorMsg
//isRightOfCall = true
isRightOfCall = true
continue
}
// Is it a "full" time ?
if regexpIsFullTime.MatchString(element) {
logLine.Time = element
continue
}
// Is it a partial time ?
if regexpIsTimePart.MatchString(element) {
if logLine.Time == "" {
if isRightOfCall == false {
if regexpIsFullTime.MatchString(element) {
logLine.Time = element
} else {
goodPart := logLine.Time[:len(logLine.Time)-len(element)]
logLine.Time = goodPart + element
continue
}
// Is it a partial time ?
if regexpIsTimePart.MatchString(element) {
if logLine.Time == "" {
logLine.Time = element
} else {
goodPart := logLine.Time[:len(logLine.Time)-len(element)]
logLine.Time = goodPart + element
}
continue
}
continue
}
// Is it the OM's name (starting with "@")
if regexpIsOMname.MatchString(element) {
logLine.OMname = strings.TrimLeft(element, "@")
@ -150,6 +154,12 @@ func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg
continue
}
if isRightOfCall {
//This is probably a RST
//TODO: is it a number (or a data report)
//TODO: it is sent or rcvd
}
//If we come here, we could not make sense of what we found
errorMsg = errorMsg + "Unable to parse " + element + " "

@ -67,6 +67,11 @@ func TestParseLine(t *testing.T) {
args{ inputStr: "#grid", previousLine: LogLine{ Mode: "SSB", }},
LogLine{ GridLoc: "grid", Mode: "SSB",}, "",
},
{
"parse partial RST",
args{ inputStr: "1230 on4kjm 5", previousLine: LogLine{ Mode: "CW", }},
LogLine{ Call: "ON4KJM", Time: "1230", RSTsent: "559", Mode: "CW",}, "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

@ -6,12 +6,15 @@
## Test framework
* [x] enable TDD
* [ ] automate build and test
* [ ] type of target (cross compile) ?
* [x] automate build and test
* [ ] Improve build processing (cross compile, directory)
* [ ] Perform the test of the complete app
## Input processing
* [ ] infer rst
* [ ] DATE keyword is now optional
* [ ] New MYGRID keyword
* [ ] Create the logic to take over from the previous line
* [ ] Support different date delimiter
* [ ] Support extrapolated date

Loading…
Cancel
Save