revert-complexity #7
|
@ -101,9 +101,9 @@ func ro gControlFlow
|
||||||
[otherThing]
|
[otherThing]
|
||||||
func ro hDataInit
|
func ro hDataInit
|
||||||
---
|
---
|
||||||
[let x:Int 3]
|
[= x:Int 3]
|
||||||
[let y:{Int} [loc x]]
|
[= y:{Int} [loc x]]
|
||||||
[let z:Int:8 (398 9 2309 983 -2387 478 555 123)]
|
[= z:Int:8 (398 9 2309 983 -2387 478 555 123)]
|
||||||
[let bird:Bird ((99999) 324)]
|
[= bird:Bird ((99999) 324)]
|
||||||
`, test)
|
`, test)
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,8 +312,6 @@ func (parser *ParsingOperation) parsePhraseCommand () (
|
||||||
identifier := command.value.(Identifier)
|
identifier := command.value.(Identifier)
|
||||||
if len(identifier.trail) == 1 {
|
if len(identifier.trail) == 1 {
|
||||||
switch identifier.trail[0] {
|
switch identifier.trail[0] {
|
||||||
case "let":
|
|
||||||
kind = PhraseKindLet
|
|
||||||
case "loc":
|
case "loc":
|
||||||
kind = PhraseKindReference
|
kind = PhraseKindReference
|
||||||
case "defer":
|
case "defer":
|
||||||
|
|
|
@ -95,7 +95,7 @@ func (what Type) ToString () (output string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (declaration Declaration) ToString (indent int) (output string) {
|
func (declaration Declaration) ToString () (output string) {
|
||||||
output += declaration.name + ":"
|
output += declaration.name + ":"
|
||||||
output += declaration.what.ToString()
|
output += declaration.what.ToString()
|
||||||
return
|
return
|
||||||
|
@ -142,7 +142,7 @@ func (argument Argument) ToString (indent int, breakLine bool) (output string) {
|
||||||
case ArgumentKindDeclaration:
|
case ArgumentKindDeclaration:
|
||||||
output += doIndent (
|
output += doIndent (
|
||||||
indent,
|
indent,
|
||||||
argument.value.(Declaration).ToString(indent))
|
argument.value.(Declaration).ToString())
|
||||||
if breakLine { output += "\n" }
|
if breakLine { output += "\n" }
|
||||||
|
|
||||||
case ArgumentKindInt, ArgumentKindUInt, ArgumentKindFloat:
|
case ArgumentKindInt, ArgumentKindUInt, ArgumentKindFloat:
|
||||||
|
@ -260,11 +260,11 @@ func (behavior FaceBehavior) ToString (indent int) (output string) {
|
||||||
output += doIndent(indent, behavior.name, "\n")
|
output += doIndent(indent, behavior.name, "\n")
|
||||||
|
|
||||||
for _, inputItem := range behavior.inputs {
|
for _, inputItem := range behavior.inputs {
|
||||||
output += doIndent(indent + 1, "> ", inputItem.ToString(indent), "\n")
|
output += doIndent(indent + 1, "> ", inputItem.ToString(), "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, outputItem := range behavior.outputs {
|
for _, outputItem := range behavior.outputs {
|
||||||
output += doIndent(indent + 1, "< ", outputItem.ToString(indent), "\n")
|
output += doIndent(indent + 1, "< ", outputItem.ToString(), "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -280,7 +280,6 @@ func (phrase Phrase) ToString (indent int, ownLine bool) (output string) {
|
||||||
switch phrase.kind {
|
switch phrase.kind {
|
||||||
case
|
case
|
||||||
PhraseKindOperator,
|
PhraseKindOperator,
|
||||||
PhraseKindLet,
|
|
||||||
PhraseKindAssign:
|
PhraseKindAssign:
|
||||||
|
|
||||||
switch phrase.operator {
|
switch phrase.operator {
|
||||||
|
@ -373,6 +372,17 @@ func (phrase Phrase) ToString (indent int, ownLine bool) (output string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (funcOutput FuncOutput) ToString (indent int) (output string) {
|
||||||
|
output += doIndent(indent + 1)
|
||||||
|
output += "< " + funcOutput.Declaration.ToString()
|
||||||
|
if funcOutput.argument.kind != ArgumentKindNil {
|
||||||
|
output += " " + funcOutput.argument.ToString(indent, false)
|
||||||
|
}
|
||||||
|
output += "\n"
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (block Block) ToString (indent int) (output string) {
|
func (block Block) ToString (indent int) (output string) {
|
||||||
for _, phrase := range block {
|
for _, phrase := range block {
|
||||||
output += phrase.ToString(indent, true)
|
output += phrase.ToString(indent, true)
|
||||||
|
@ -391,15 +401,15 @@ func (section FuncSection) ToString (indent int) (output string) {
|
||||||
if section.receiver != nil {
|
if section.receiver != nil {
|
||||||
output += doIndent (
|
output += doIndent (
|
||||||
indent + 1,
|
indent + 1,
|
||||||
"@ ", section.receiver.ToString(indent), "\n")
|
"@ ", section.receiver.ToString(), "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, inputItem := range section.inputs {
|
for _, inputItem := range section.inputs {
|
||||||
output += doIndent(indent + 1, "> ", inputItem.ToString(indent), "\n")
|
output += doIndent(indent + 1, "> ", inputItem.ToString(), "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, outputItem := range section.outputs {
|
for _, outputItem := range section.outputs {
|
||||||
output += doIndent(indent + 1, "< ", outputItem.ToString(indent), "\n")
|
output += outputItem.ToString(indent)
|
||||||
}
|
}
|
||||||
|
|
||||||
output += doIndent(indent + 1, "---\n")
|
output += doIndent(indent + 1, "---\n")
|
||||||
|
|
|
@ -217,7 +217,6 @@ const (
|
||||||
PhraseKindCall = iota
|
PhraseKindCall = iota
|
||||||
PhraseKindCallExternal
|
PhraseKindCallExternal
|
||||||
PhraseKindOperator
|
PhraseKindOperator
|
||||||
PhraseKindLet
|
|
||||||
PhraseKindAssign
|
PhraseKindAssign
|
||||||
PhraseKindReference
|
PhraseKindReference
|
||||||
PhraseKindDefer
|
PhraseKindDefer
|
||||||
|
|
|
@ -124,11 +124,11 @@ func ro gControlFlow
|
||||||
|
|
||||||
func ro hDataInit
|
func ro hDataInit
|
||||||
---
|
---
|
||||||
let x:Int 3
|
= x:Int 3
|
||||||
# loc is a reference, similar to * in C
|
# loc is a reference, similar to * in C
|
||||||
let y:{Int} [loc x]
|
= y:{Int} [loc x]
|
||||||
let z:Int:8 (398 9 2309 983 -2387
|
= z:Int:8 (398 9 2309 983 -2387
|
||||||
478 555 123)
|
478 555 123)
|
||||||
let bird:Bird (
|
= bird:Bird (
|
||||||
(99999)
|
(99999)
|
||||||
324)
|
324)
|
||||||
|
|
Reference in New Issue
Block a user