summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorSilvan Jegen <s.jegen@gmail.com>2016-12-25 14:45:13 +0100
committerSilvan Jegen <s.jegen@gmail.com>2016-12-25 14:45:13 +0100
commitbe3749d9f77e1410c11d0e8b7158a13e51faa41c (patch)
treed511852b1af04c740b29e41133a1f47de7e54f7c /main.go
parentb0c4b2fbd4098f88b1abc854854fa24c7402c70a (diff)
Implement lexer based on Scanner
We also add the skeleton of a recursive descent parser.
Diffstat (limited to 'main.go')
-rw-r--r--main.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/main.go b/main.go
index 23ae701..7a3bb88 100644
--- a/main.go
+++ b/main.go
@@ -1,14 +1,27 @@
package main
import (
+ "bufio"
+ "fmt"
+ "os"
"strings"
+ "github.com/Shugyousha/stasher/conf"
"github.com/Shugyousha/stasher/filter"
"github.com/Shugyousha/stasher/input"
"github.com/Shugyousha/stasher/output"
)
func main() {
+ f, err := os.Open("stasher.cfg")
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Could not open config file 'stasher.cfg': %q\n", err)
+ os.Exit(1)
+ }
+
+ c := conf.NewConfig(bufio.NewReader(f))
+ fmt.Fprintf(os.Stderr, "config: %#v\n", c)
+
ffmap := make(map[string]func(string) string, 10)
ffmap["F"] = func(s string) string { return strings.ToUpper(s) }