Skip to content

Commit

Permalink
Fix comment parsing when there is not space after #. Fixes #8.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnenauha committed Dec 19, 2018
1 parent e8ec722 commit c63868a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions obj-parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ func wrapErrorLine(err error, linenum int) error {

func parseLineType(str string) (objectfile.Type, string) {
value := ""
// comments, unlike other tokens, might not have a space after #
if str[0] == '#' {
return objectfile.Comment, strings.TrimSpace(str[1:])
}
if i := strings.Index(str, " "); i != -1 {
value = strings.TrimSpace(str[i+1:])
str = str[0:i]
Expand Down

0 comments on commit c63868a

Please sign in to comment.