summaryrefslogtreecommitdiff
path: root/parser.go
diff options
context:
space:
mode:
authorAdam Scarr <adam@vektah.net>2017-08-06 17:02:39 +1000
committerAdam Scarr <adam@vektah.net>2017-08-06 17:02:39 +1000
commita65a9325aaebd1499a8e523463cc023124f8536a (patch)
tree2fb31800b67a3914a7204a28319a7aeb0ac649c7 /parser.go
parent8b343d6360d0edc065b9b62ab5e708e907b45a92 (diff)
Get the HTML parser working
Diffstat (limited to 'parser.go')
-rw-r--r--parser.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/parser.go b/parser.go
index 82b5d56..3c5d752 100644
--- a/parser.go
+++ b/parser.go
@@ -67,7 +67,7 @@ func Exact(match string) Parser {
return NewError(p.pos, "Expected "+match), p
}
- return NewToken(p.pos, match), p.Advance(len(match))
+ return match, p.Advance(len(match))
}
}
@@ -79,7 +79,7 @@ func Char(match string) Parser {
return NewError(p.pos, "Expected one of "+string(match)), p
}
- return NewToken(p.pos, string(r)), p.Advance(w)
+ return string(r), p.Advance(w)
}
}
@@ -98,7 +98,7 @@ func CharRun(match string) Parser {
return NewError(p.pos, "Expected some of "+match), p
}
- return NewToken(p.pos, p.input[p.pos:p.pos+matched]), p.Advance(matched)
+ return p.input[p.pos : p.pos+matched], p.Advance(matched)
}
}
@@ -117,7 +117,7 @@ func CharRunUntil(match string) Parser {
return NewError(p.pos, "Expected some of "+match), p
}
- return NewToken(p.pos, p.input[p.pos:p.pos+matched]), p.Advance(matched)
+ return p.input[p.pos : p.pos+matched], p.Advance(matched)
}
}
@@ -177,7 +177,7 @@ func Range(r string, repetition ...int) Parser {
return NewError(p.pos+matched, fmt.Sprintf("Expected at least %d more of %s", min-matched, r)), p
}
- return NewToken(p.pos, p.input[p.pos:p.pos+matched]), p.Advance(matched)
+ return p.input[p.pos : p.pos+matched], p.Advance(matched)
}
}