diff options
| author | Charlie Stanton <charlie@shtanton.xyz> | 2023-05-12 14:25:32 +0100 | 
|---|---|---|
| committer | Charlie Stanton <charlie@shtanton.xyz> | 2023-05-12 14:25:32 +0100 | 
| commit | 3c34366bdd5d817a184d6b1c901d03a16b6faa4b (patch) | |
| tree | 0a084781caf7f062b52d8c0a7481e87afb7d5caa /walk | |
| parent | 551613765c9e60e2221ac920d2756b949e68f373 (diff) | |
| download | stred-go-3c34366bdd5d817a184d6b1c901d03a16b6faa4b.tar | |
Adds the json_array IO format
Diffstat (limited to 'walk')
| -rw-r--r-- | walk/atom.go | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/walk/atom.go b/walk/atom.go index dfe5fe4..299c39d 100644 --- a/walk/atom.go +++ b/walk/atom.go @@ -37,6 +37,12 @@ func NewAtomBool(v bool) Atom {  		}  	}  } +func (v Atom) Bool() bool { +	if v.Typ != AtomBool { +		panic("Tried to use non-bool as bool") +	} +	return v.data == 1 +}  func NewAtomNumber(v float64) Atom {  	return Atom {  		Typ: AtomNumber, @@ -73,6 +79,12 @@ func NewAtomStringRune(v rune) Atom {  		data: uint64(v),  	}  } +func (v Atom) StringRune() rune { +	if v.Typ != AtomStringRune { +		panic("Tried to use non-stringrune as stringrune") +	} +	return rune(v.data) +}  func (v Atom) String() string {  	switch v.Typ {  		case AtomNull: | 
