Revert "Permit comment after other input on the line (#119)" (#125)

This reverts commit caefd46994.
pull/127/head
Bryan Nehl 8 months ago committed by GitHub
parent 1b1c150af4
commit b81a828749
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -53,7 +53,6 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL
isInferTimeFatalError := false isInferTimeFatalError := false
regexpLineComment := regexp.MustCompile(`^[[:blank:]]*#`) regexpLineComment := regexp.MustCompile(`^[[:blank:]]*#`)
regexpInLineComment := regexp.MustCompile(`.*#.*`)
regexpOnlySpaces := regexp.MustCompile(`^\s+$`) regexpOnlySpaces := regexp.MustCompile(`^\s+$`)
regexpSingleMultiLineComment := regexp.MustCompile(`^[[:blank:]]*{.+}$`) regexpSingleMultiLineComment := regexp.MustCompile(`^[[:blank:]]*{.+}$`)
regexpStartMultiLineComment := regexp.MustCompile(`^[[:blank:]]*{`) regexpStartMultiLineComment := regexp.MustCompile(`^[[:blank:]]*{`)
@ -105,10 +104,6 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL
if (len(eachline) == 0) || (regexpOnlySpaces.MatchString(eachline)) { if (len(eachline) == 0) || (regexpOnlySpaces.MatchString(eachline)) {
continue continue
} }
// a comment starts somewhere on the line, remove the comment
if regexpInLineComment.MatchString(eachline) {
eachline = strings.Split(eachline, "#")[0]
}
// Process multi-line comments // Process multi-line comments
if regexpStartMultiLineComment.MatchString(eachline) { if regexpStartMultiLineComment.MatchString(eachline) {

@ -49,7 +49,6 @@ func TestLoadFile_happyCase(t *testing.T) {
dataArray = append(dataArray, "40m cw 0950 ik5zve/5 9 5") dataArray = append(dataArray, "40m cw 0950 ik5zve/5 9 5")
dataArray = append(dataArray, "on6zq") dataArray = append(dataArray, "on6zq")
dataArray = append(dataArray, "0954 on4do") dataArray = append(dataArray, "0954 on4do")
dataArray = append(dataArray, "0955 k0emt # on line comment")
temporaryDataFileName := createTestFile(dataArray) temporaryDataFileName := createTestFile(dataArray)
@ -116,14 +115,6 @@ func TestLoadFile_happyCase(t *testing.T) {
if loadedLogFile[2].Time != expectedValue { if loadedLogFile[2].Time != expectedValue {
t.Errorf("Not the expected Time[2] value: %s (expecting %s)", loadedLogFile[2].Time, expectedValue) t.Errorf("Not the expected Time[2] value: %s (expecting %s)", loadedLogFile[2].Time, expectedValue)
} }
expectedValue = "K0EMT"
if loadedLogFile[3].Call != expectedValue {
t.Errorf("Not the expected Call[3] value: %s (expecting %s)", loadedLogFile[3].Call, expectedValue)
}
expectedValue = "0955"
if loadedLogFile[3].Time != expectedValue {
t.Errorf("Not the expected Time[3] value: %s (expecting %s)", loadedLogFile[3].Time, expectedValue)
}
//Clean Up //Clean Up
os.Remove(temporaryDataFileName) os.Remove(temporaryDataFileName)
} }

Loading…
Cancel
Save