Func section tostrings and parses output values properly
This commit is contained in:
parent
7374de2633
commit
a31c975c9d
@ -187,28 +187,33 @@ func (parser *ParsingOperation) parseFuncArguments (
|
||||
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,11 +379,14 @@ 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