summaryrefslogtreecommitdiff
path: root/literals.go
diff options
context:
space:
mode:
authorÖzgür Kesim <oec@codeblau.de>2019-11-28 15:34:30 +0100
committerÖzgür Kesim <oec@codeblau.de>2019-11-28 15:34:30 +0100
commite2fa16706ce0e07d474460acffa6c249ba7503b1 (patch)
treeba4a907025cb779ee182b78154ce994776f76f79 /literals.go
parent9bc60a23116a1992e56d3a2754df6523bc565e99 (diff)
added .Start and .End to Result
Diffstat (limited to 'literals.go')
-rw-r--r--literals.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/literals.go b/literals.go
index 260a26e..0e3e89f 100644
--- a/literals.go
+++ b/literals.go
@@ -59,12 +59,16 @@ func StringLit(allowedQuotes string) Parser {
}
case quote:
if buf == nil {
+ node.Start = ps.Pos + 1
+ node.End = end
node.Token = ps.Input[ps.Pos+1 : end]
ps.Pos = end + 1
return
}
- ps.Pos = end + 1
node.Token = buf.String()
+ node.Start = ps.Pos
+ node.End = ps.Pos + len(node.Token)
+ ps.Pos = end + 1
return
default:
if buf == nil {
@@ -139,6 +143,8 @@ func NumberLit() Parser {
ps.ErrorHere("number")
return
}
+ node.Start = ps.Pos
+ node.End = end
ps.Pos = end
})
}