Removed old things from tree-tostring.go

This commit is contained in:
Sasha Koshka 2022-09-15 15:10:52 -04:00
parent df1636e8fa
commit eaeba12fbe
3 changed files with 24 additions and 81 deletions

View File

@ -6,49 +6,31 @@ func TestData (test *testing.T) {
checkTree ("../tests/parser/data", false,
`:arf
---
data ro aInteger:Int 3202
data ro bMutInteger:Int:mut 3202
data ro aInteger:Int:<3202>
data ro bMutInteger:Int:mut:<3202>
data ro cIntegerPointer:{Int}
data ro dMutIntegerPointer:{Int}:mut
data ro eIntegerArray16:Int:16
data ro fIntegerArrayVariable:{Int ..}
data ro gIntegerArrayInitialized:Int:16
3948
293
293049
948
912
340
0
2304
0
4785
92
data ro jObject:thing.Thing.thing.thing
-- that 2139
-- this 324
data ro kNestedObject:Obj
ro newMember:Int 9023
-- that
-- bird2 123.8439
-- bird3 9328.21348239
-- this
-- bird0 324
-- bird1 "hello world"
data ro gIntegerArrayInitialized:Int:16:<
3948 293 293049 948 912
340 0 2304 0 4785 92>
data ro jObject:Obj:(
.this:<324>
.that:<324>)
data ro kNestedObject:Obj:(
.ro newMember:Int:<9023>
.this:(
.bird0:<324>
.bird1:<"hello world">)
.that:(
.bird2:<123.8439>
.bird3:<9328.21348239>))
data ro lMutIntegerArray16:Int:16:mut
data ro mExternalData:Int:8
external
data ro nIntegerArrayInitialized:Int:16:mut
3948
293
293049
948
912
340
0
2304
0
4785
92
data ro nIntegerArrayInitialized:Int:16:mut:<
3948 293 293049 948 912
340 0 2304 0 4785 92>
`, test)
}

View File

@ -98,38 +98,6 @@ func (declaration Declaration) ToString () (output string) {
return
}
func (attributes ObjectDefaultValues) ToString (
indent int,
) (
output string,
) {
for _, name := range sortMapKeysAlphabetically(attributes) {
value := attributes[name]
output += doIndent(indent, ".", name)
if value.kind == ArgumentKindObjectDefaultValues {
output += "\n"
output += value.ToString(indent + 1, true)
} else {
output += " " + value.ToString(0, false) + "\n"
}
}
return
}
func (values ArrayDefaultValues) ToString (
indent int,
) (
output string,
) {
for _, value := range values {
output += value.ToString(indent, true)
}
return
}
func (argument Argument) ToString (indent int, breakLine bool) (output string) {
if !breakLine { indent = 0 }
if argument.kind == ArgumentKindNil {
@ -144,15 +112,8 @@ func (argument Argument) ToString (indent int, breakLine bool) (output string) {
indent,
breakLine)
case ArgumentKindObjectDefaultValues:
// this should only appear in contexts where breakLine is true
output += argument.value.(ObjectDefaultValues).
ToString(indent)
case ArgumentKindArrayDefaultValues:
// this should only appear in contexts where breakLine is true
output += argument.value.(ArrayDefaultValues).
ToString(indent)
case ArgumentKindArrayDefaultValues, ArgumentKindObjectDefaultValues:
output += "DEFAULT VALUES IN WRONG PLACE"
case ArgumentKindIdentifier:
output += doIndent (

View File

@ -18,10 +18,10 @@ data ro gIntegerArrayInitialized:Int:16:<
340 0 2304 0 4785 92
>
# TODO: reinstate these two after phrase parsing is implemented
# data wr hIntegerPointerInit:{Int} [& integer]
# TODO: reinstate these two
# data wr hIntegerPointerInit:{Int}:<[& integer]>
# data wr iMutIntegerPointerInit:{Int}:mut [& integer]
# data wr iMutIntegerPointerInit:{Int}:mut:<[& integer]>
data ro jObject:Obj:(
.this:<324>