mirror of
https://github.com/kataras/iris.git
synced 2025-12-26 22:37:08 +00:00
Nothing special here (yet)
Former-commit-id: 826d7c370481b78afd9ba92f4ae8bef1fb85a567
This commit is contained in:
31
_future/ipel/repl/repl.go
Normal file
31
_future/ipel/repl/repl.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package repl
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"gopkg.in/kataras/iris.v6/_future/ipel/lexer"
|
||||
"gopkg.in/kataras/iris.v6/_future/ipel/token"
|
||||
)
|
||||
|
||||
const PROMPT = ">> "
|
||||
|
||||
func Start(in io.Reader, out io.Writer) {
|
||||
scanner := bufio.NewScanner(in)
|
||||
for {
|
||||
fmt.Printf(PROMPT)
|
||||
scanned := scanner.Scan()
|
||||
if !scanned {
|
||||
return
|
||||
}
|
||||
line := scanner.Text()
|
||||
if line == "exit" {
|
||||
break
|
||||
}
|
||||
l := lexer.New(line)
|
||||
for tok := l.NextToken(); tok.Type != token.EOF; tok = l.NextToken() {
|
||||
fmt.Printf("%+v\n", tok)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user