|
@@ -290,6 +290,10 @@ func Parse(rwc io.Reader) (*Result, error) {
|
|
}
|
|
}
|
|
currentLine++
|
|
currentLine++
|
|
|
|
|
|
|
|
+ if isComment(scanner.Bytes()) {
|
|
|
|
+ // original line was a comment (processLine strips comments)
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
if isEmptyContinuationLine(bytesRead) {
|
|
if isEmptyContinuationLine(bytesRead) {
|
|
hasEmptyContinuationLine = true
|
|
hasEmptyContinuationLine = true
|
|
continue
|
|
continue
|
|
@@ -331,8 +335,12 @@ func trimWhitespace(src []byte) []byte {
|
|
return bytes.TrimLeftFunc(src, unicode.IsSpace)
|
|
return bytes.TrimLeftFunc(src, unicode.IsSpace)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func isComment(line []byte) bool {
|
|
|
|
+ return tokenComment.Match(trimWhitespace(line))
|
|
|
|
+}
|
|
|
|
+
|
|
func isEmptyContinuationLine(line []byte) bool {
|
|
func isEmptyContinuationLine(line []byte) bool {
|
|
- return len(trimComments(trimWhitespace(line))) == 0
|
|
|
|
|
|
+ return len(trimWhitespace(line)) == 0
|
|
}
|
|
}
|
|
|
|
|
|
var utf8bom = []byte{0xEF, 0xBB, 0xBF}
|
|
var utf8bom = []byte{0xEF, 0xBB, 0xBF}
|