Last active
February 6, 2021 18:09
-
-
Save korzio/3a901d6b1ca182bbd5c24c577e06122d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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