func main() {
var s scanner.Scanner
s.Init(strings.NewReader("Foo 1 2.5 -3 -0.54"))
s.Mode = scanner.GoTokens
for tok := s.Scan(); tok != scanner.EOF; tok = s.Scan() {
fmt.Println("Tok: ", s.TokenText())
}
}
Tok: Foo
Tok: 1
Tok: 2.5
Tok: -
Tok: 3
Tok: -
Tok: 0.54
On Sat, Aug 3, 2013 at 3:58 PM, <dvi...@gmail.com> wrote:
Design the tokenizer of your DSL to expect ]unary] '+'/'-' as a
separate token as well, which is pretty standard anyway[0]; and you're
good to go.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.