Stub for analyzing type specifiers

This commit is contained in:
Sasha Koshka 2022-09-20 11:01:56 -04:00
parent 92ac258dbe
commit b3ebd7a259
2 changed files with 18 additions and 4 deletions

View File

@ -40,6 +40,7 @@ func (analyzer AnalysisOperation) analyzeTypeSection () (
outputSection.where = analyzer.currentPosition
outputSection.what, err = analyzer.analyzeType(inputSection.Type())
if err != nil { return }
outputSection.complete = true
return

View File

@ -1,6 +1,7 @@
package analyzer
import "git.tebibyte.media/arf/arf/types"
import "git.tebibyte.media/arf/arf/parser"
// TypeKind represents what kind of type a type is.
type TypeKind int
@ -28,8 +29,7 @@ type ObjectMember struct {
// how many members objects have.
permission types.Permission
// TODO: create argument type similar to what's in the parser and have
// a defaultValue member here.
what Type
}
func (member ObjectMember) ToString (indent int) (output string) {
@ -37,8 +37,8 @@ func (member ObjectMember) ToString (indent int) (output string) {
indent,
member.name, " ",
member.permission.ToString(),
// TODO: default value
"\n")
output += member.what.ToString(indent + 1)
return
}
@ -96,3 +96,16 @@ func (what Type) ToString (indent int) (output string) {
}
return
}
// analyzeType analyzes a type specifier.
func (analyzer AnalysisOperation) analyzeType (
inputType parser.Type,
) (
outputType Type,
err error,
) {
// TODO
outputType.mutable = inputType.Mutable()
return
}