Face test is now passed
This commit is contained in:
parent
2ceb3f8174
commit
3e1acdc74a
@ -47,11 +47,13 @@ func (parser *ParsingOperation) parseFaceSection () (
|
|||||||
|
|
||||||
if parser.token.Is(lexer.TokenKindName) {
|
if parser.token.Is(lexer.TokenKindName) {
|
||||||
// parse type interface
|
// parse type interface
|
||||||
|
section.kind = FaceKindType
|
||||||
parser.previousToken()
|
parser.previousToken()
|
||||||
section.behaviors, err = parser.parseFaceBehaviors()
|
section.behaviors, err = parser.parseFaceBehaviors()
|
||||||
if err != nil { return }
|
if err != nil { return }
|
||||||
} else {
|
} else {
|
||||||
// parse function interface
|
// parse function interface
|
||||||
|
section.kind = FaceKindFunc
|
||||||
parser.previousToken()
|
parser.previousToken()
|
||||||
section.inputs,
|
section.inputs,
|
||||||
section.outputs, err = parser.parseFaceBehaviorArguments(1)
|
section.outputs, err = parser.parseFaceBehaviorArguments(1)
|
||||||
@ -157,15 +159,16 @@ func (parser *ParsingOperation) parseFaceBehaviorArguments (
|
|||||||
if err != nil { return }
|
if err != nil { return }
|
||||||
declaration.what, err = parser.parseType()
|
declaration.what, err = parser.parseType()
|
||||||
if err != nil { return }
|
if err != nil { return }
|
||||||
err = parser.expect(lexer.TokenKindNewline)
|
|
||||||
if err != nil { return }
|
|
||||||
err = parser.nextToken()
|
|
||||||
if err != nil { return }
|
|
||||||
|
|
||||||
if kind == lexer.TokenKindGreaterThan {
|
if kind == lexer.TokenKindGreaterThan {
|
||||||
inputs = append(inputs, declaration)
|
inputs = append(inputs, declaration)
|
||||||
} else {
|
} else {
|
||||||
outputs = append(outputs, declaration)
|
outputs = append(outputs, declaration)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = parser.expect(lexer.TokenKindNewline)
|
||||||
|
if err != nil { return }
|
||||||
|
err = parser.nextToken()
|
||||||
|
if err != nil { return }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,10 +250,21 @@ func (section FaceSection) ToString (indent int) (output string) {
|
|||||||
section.name, ":",
|
section.name, ":",
|
||||||
section.inherits.ToString(), "\n")
|
section.inherits.ToString(), "\n")
|
||||||
|
|
||||||
for _, name := range sortMapKeysAlphabetically(section.behaviors) {
|
if section.kind == FaceKindType {
|
||||||
behavior := section.behaviors[name]
|
for _, name := range sortMapKeysAlphabetically(section.behaviors) {
|
||||||
output += behavior.ToString(indent + 1)
|
behavior := section.behaviors[name]
|
||||||
|
output += behavior.ToString(indent + 1)
|
||||||
|
}
|
||||||
|
} else if section.kind == FaceKindFunc {
|
||||||
|
for _, inputItem := range section.inputs {
|
||||||
|
output += doIndent(indent + 1, "> ", inputItem.ToString(), "\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, outputItem := range section.outputs {
|
||||||
|
output += doIndent(indent + 1, "< ", outputItem.ToString(), "\n")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,8 @@ type EnumSection struct {
|
|||||||
type FaceKind int
|
type FaceKind int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
FaceKindType FaceKind = iota
|
FaceKindEmpty FaceKind = iota
|
||||||
|
FaceKindType
|
||||||
FaceKindFunc
|
FaceKindFunc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user