diff options
Diffstat (limited to 'lex')
-rw-r--r-- | lex/type.go | 23 |
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 +} |