<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/walk/walk.go
diff options
context:
space:
mode:
Diffstat (limited to 'walk/walk.go')
-rw-r--r--walk/walk.go21
1 files changed, 6 insertions, 15 deletions
diff --git a/walk/walk.go b/walk/walk.go
index 72fbe11..5c1ca75 100644
--- a/walk/walk.go
+++ b/walk/walk.go
@@ -99,22 +99,19 @@ func (value ValueNumber) String() string {
}
func (value ValueNumber) atomness() {}
-type StartString struct {}
-func (value StartString) atomness() {}
-
-type EndString struct {}
-func (value EndString) atomness() {}
+type StringTerminal struct {}
+func (value StringTerminal) atomness() {}
type StringAtom rune
func (value StringAtom) atomness() {}
type ValueString string
func (value ValueString) Pieces(out chan<- Atom) {
- out<-StartString{}
+ out<-StringTerminal{}
for _, char := range value {
out<-StringAtom(char)
}
- out<-EndString{}
+ out<-StringTerminal{}
}
func (value ValueString) String() string {
return fmt.Sprintf("\"%s\"", string(value))
@@ -456,7 +453,6 @@ type CompoundError int
const (
CompoundRuneOutsideString CompoundError = iota
- CompoundEndStringOutsideString
CompoundUnknownAtom
CompoundMissingEnd
CompoundInvalidStringAtom
@@ -466,8 +462,6 @@ func (err CompoundError) Error() string {
switch err {
case CompoundRuneOutsideString:
return "Compound Error: Rune Outside String"
- case CompoundEndStringOutsideString:
- return "Compound Error: End String Outside String"
case CompoundUnknownAtom:
return "Compound Error: Unknown Atom"
case CompoundMissingEnd:
@@ -508,10 +502,7 @@ func Compound(in <-chan Atom) <-chan CompoundResult {
case StringAtom:
out<-CompoundResult{nil, CompoundRuneOutsideString}
break outer
- case EndString:
- out<-CompoundResult{nil, CompoundEndStringOutsideString}
- break outer
- case StartString:
+ case StringTerminal:
default:
out<-CompoundResult{nil, CompoundUnknownAtom}
break outer
@@ -525,7 +516,7 @@ func Compound(in <-chan Atom) <-chan CompoundResult {
break outer
}
switch v := atom.(type) {
- case EndString:
+ case StringTerminal:
break loop
case StringAtom:
builder.WriteRune(rune(v))