Func section tostrings and parses output values properly
This commit is contained in:
parent
7374de2633
commit
a31c975c9d
@ -186,29 +186,34 @@ func (parser *ParsingOperation) parseFuncArguments (
|
||||
if err != nil { return }
|
||||
output.what, err = parser.parseType()
|
||||
if err != nil { return }
|
||||
|
||||
into.outputs = append(into.outputs, output)
|
||||
|
||||
// skip newline if it is there
|
||||
if parser.token.Is(lexer.TokenKindNewline) {
|
||||
parser.nextToken()
|
||||
// if we have exited the output, break
|
||||
if !parser.token.Is(lexer.TokenKindIndent) { break }
|
||||
if parser.token.Value().(int) != 2 { break }
|
||||
exited :=
|
||||
!parser.token.Is(lexer.TokenKindIndent) ||
|
||||
parser.token.Value().(int) != 2
|
||||
|
||||
if exited {
|
||||
into.outputs = append(into.outputs, output)
|
||||
break
|
||||
}
|
||||
|
||||
err = parser.nextToken()
|
||||
if err != nil { return }
|
||||
}
|
||||
|
||||
// if default value exists, get it
|
||||
if !parser.token.Is(lexer.TokenKindBinaryAnd) {
|
||||
output.argument, err = parser.parseArgument()
|
||||
}
|
||||
// get default value
|
||||
output.argument, err = parser.parseArgument()
|
||||
into.outputs = append(into.outputs, output)
|
||||
if err != nil { return }
|
||||
|
||||
err = parser.expect(lexer.TokenKindNewline)
|
||||
if err != nil { return }
|
||||
|
||||
err = parser.nextToken()
|
||||
if err != nil { return }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -379,10 +379,13 @@ func (phrase Phrase) ToString (indent int, ownLine bool) (output string) {
|
||||
func (funcOutput FuncOutput) ToString (indent int) (output string) {
|
||||
output += doIndent(indent + 1)
|
||||
output += "< " + funcOutput.Declaration.ToString()
|
||||
// why is it always nil??? WHY???
|
||||
if funcOutput.argument.kind != ArgumentKindNil {
|
||||
output += " " + funcOutput.argument.ToString(indent, false)
|
||||
}
|
||||
output += "\n"
|
||||
|
||||
print(funcOutput.argument.ToString(0, true))
|
||||
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user