Skip to content

Commit

Permalink
elipsis is an atom
Browse files Browse the repository at this point in the history
  • Loading branch information
ichiban committed Jul 8, 2023
1 parent 07b054c commit c6a441e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions engine/atom.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ var (
atomBitwiseLeftShift = NewAtom("<<")
atomBitwiseAnd = NewAtom(`/\`)
atomBitwiseOr = NewAtom(`\/`)
atomElipsis = NewAtom(`...`)

atomAbs = NewAtom("abs")
atomAccess = NewAtom("access")
Expand Down
4 changes: 2 additions & 2 deletions engine/compound.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func WriteCompound(w io.Writer, c Compound, opts *WriteOptions, env *Env) error

func writeCompoundVisit(w io.Writer, c Compound, opts *WriteOptions) (bool, error) {
if _, ok := opts.visited[id(c)]; ok {
_, err := w.Write([]byte("..."))
err := atomElipsis.WriteTerm(w, opts, nil)
return true, err
}
return false, nil
Expand Down Expand Up @@ -87,7 +87,7 @@ func writeCompoundList(w io.Writer, c Compound, opts *WriteOptions, env *Env) er
_, _ = fmt.Fprint(&ew, "|")
s := iter.Suffix()
if l, ok := iter.Suffix().(Compound); ok && l.Functor() == atomDot && l.Arity() == 2 {
_, _ = fmt.Fprint(&ew, "...")
_ = atomElipsis.WriteTerm(&ew, opts, nil)
} else {
_ = s.WriteTerm(&ew, opts, env)
}
Expand Down

0 comments on commit c6a441e

Please sign in to comment.