Skip to content

Instantly share code, notes, and snippets.

@korzio
Last active February 6, 2021 18:09
Show Gist options
  • Save korzio/3a901d6b1ca182bbd5c24c577e06122d to your computer and use it in GitHub Desktop.
Save korzio/3a901d6b1ca182bbd5c24c577e06122d to your computer and use it in GitHub Desktop.
package lexer
import (
"fmt"
"strings"
"pizzascript/token"
"github.com/reactivex/rxgo/v2"
)
type Lexer struct {
input string
observable rxgo.Observable
}
func New(input string) *Lexer {
observable := rxgo.Just(input)().FlatMap(func(i rxgo.Item) rxgo.Observable {
splitted := strings.Split(i.V.(string), "")
return rxgo.Just(splitted)()
})
l := &Lexer{input: input, observable: observable}
return l
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment