Removed old things from tree-tostring.go
This commit is contained in:
parent
df1636e8fa
commit
eaeba12fbe
@ -6,49 +6,31 @@ func TestData (test *testing.T) {
|
|||||||
checkTree ("../tests/parser/data", false,
|
checkTree ("../tests/parser/data", false,
|
||||||
`:arf
|
`:arf
|
||||||
---
|
---
|
||||||
data ro aInteger:Int 3202
|
data ro aInteger:Int:<3202>
|
||||||
data ro bMutInteger:Int:mut 3202
|
data ro bMutInteger:Int:mut:<3202>
|
||||||
data ro cIntegerPointer:{Int}
|
data ro cIntegerPointer:{Int}
|
||||||
data ro dMutIntegerPointer:{Int}:mut
|
data ro dMutIntegerPointer:{Int}:mut
|
||||||
data ro eIntegerArray16:Int:16
|
data ro eIntegerArray16:Int:16
|
||||||
data ro fIntegerArrayVariable:{Int ..}
|
data ro fIntegerArrayVariable:{Int ..}
|
||||||
data ro gIntegerArrayInitialized:Int:16
|
data ro gIntegerArrayInitialized:Int:16:<
|
||||||
3948
|
3948 293 293049 948 912
|
||||||
293
|
340 0 2304 0 4785 92>
|
||||||
293049
|
data ro jObject:Obj:(
|
||||||
948
|
.this:<324>
|
||||||
912
|
.that:<324>)
|
||||||
340
|
data ro kNestedObject:Obj:(
|
||||||
0
|
.ro newMember:Int:<9023>
|
||||||
2304
|
.this:(
|
||||||
0
|
.bird0:<324>
|
||||||
4785
|
.bird1:<"hello world">)
|
||||||
92
|
.that:(
|
||||||
data ro jObject:thing.Thing.thing.thing
|
.bird2:<123.8439>
|
||||||
-- that 2139
|
.bird3:<9328.21348239>))
|
||||||
-- 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 lMutIntegerArray16:Int:16:mut
|
data ro lMutIntegerArray16:Int:16:mut
|
||||||
data ro mExternalData:Int:8
|
data ro mExternalData:Int:8
|
||||||
external
|
external
|
||||||
data ro nIntegerArrayInitialized:Int:16:mut
|
data ro nIntegerArrayInitialized:Int:16:mut:<
|
||||||
3948
|
3948 293 293049 948 912
|
||||||
293
|
340 0 2304 0 4785 92>
|
||||||
293049
|
|
||||||
948
|
|
||||||
912
|
|
||||||
340
|
|
||||||
0
|
|
||||||
2304
|
|
||||||
0
|
|
||||||
4785
|
|
||||||
92
|
|
||||||
`, test)
|
`, test)
|
||||||
}
|
}
|
||||||
|
@ -98,38 +98,6 @@ func (declaration Declaration) ToString () (output string) {
|
|||||||
return
|
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) {
|
func (argument Argument) ToString (indent int, breakLine bool) (output string) {
|
||||||
if !breakLine { indent = 0 }
|
if !breakLine { indent = 0 }
|
||||||
if argument.kind == ArgumentKindNil {
|
if argument.kind == ArgumentKindNil {
|
||||||
@ -144,15 +112,8 @@ func (argument Argument) ToString (indent int, breakLine bool) (output string) {
|
|||||||
indent,
|
indent,
|
||||||
breakLine)
|
breakLine)
|
||||||
|
|
||||||
case ArgumentKindObjectDefaultValues:
|
case ArgumentKindArrayDefaultValues, ArgumentKindObjectDefaultValues:
|
||||||
// this should only appear in contexts where breakLine is true
|
output += "DEFAULT VALUES IN WRONG PLACE"
|
||||||
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 ArgumentKindIdentifier:
|
case ArgumentKindIdentifier:
|
||||||
output += doIndent (
|
output += doIndent (
|
||||||
|
@ -18,10 +18,10 @@ data ro gIntegerArrayInitialized:Int:16:<
|
|||||||
340 0 2304 0 4785 92
|
340 0 2304 0 4785 92
|
||||||
>
|
>
|
||||||
|
|
||||||
# TODO: reinstate these two after phrase parsing is implemented
|
# TODO: reinstate these two
|
||||||
# data wr hIntegerPointerInit:{Int} [& integer]
|
# data wr hIntegerPointerInit:{Int}:<[& integer]>
|
||||||
|
|
||||||
# data wr iMutIntegerPointerInit:{Int}:mut [& integer]
|
# data wr iMutIntegerPointerInit:{Int}:mut:<[& integer]>
|
||||||
|
|
||||||
data ro jObject:Obj:(
|
data ro jObject:Obj:(
|
||||||
.this:<324>
|
.this:<324>
|
||||||
|
Reference in New Issue
Block a user