summaryrefslogtreecommitdiff
path: root/lex/type.go
diff options
context:
space:
mode:
authorJoop Kiefte <ikojba@gmail.com>2018-12-31 17:53:02 +0100
committerJoop Kiefte <ikojba@gmail.com>2018-12-31 17:53:02 +0100
commit20be238175eecc5e68b74d0e98e5ec428610a904 (patch)
tree6332fbaa903275990a87aacd57dd31161e3b00e6 /lex/type.go
parent22fab0a8bc6ae7f468c91ed2835a55226270afad (diff)
Beginning of the new structure under the Lexington name
Diffstat (limited to 'lex/type.go')
-rw-r--r--lex/type.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/lex/type.go b/lex/type.go
new file mode 100644
index 0000000..47439f4
--- /dev/null
+++ b/lex/type.go
@@ -0,0 +1,23 @@
+package lex
+
+import (
+ "io"
+ "fmt"
+)
+
+type Screenplay []Line
+
+type Line struct{
+ Type string
+ Contents string
+}
+
+func Parse(file io.Reader) (out Screenplay) {
+ var err error
+ line := Line{}
+ for err == nil {
+ _, err = fmt.Fscanf(file, "%s: %s", &line.Type, &line.Contents)
+ out = append(out, line)
+ }
+ return out
+}