Iterator actually advances now
This commit is contained in:
parent
b2cc45abec
commit
ed4c9aa0d2
@ -29,8 +29,7 @@ func (analyzer AnalysisOperation) analyzeArgument (
|
||||
) {
|
||||
switch inputArgument.Kind() {
|
||||
case parser.ArgumentKindNil:
|
||||
panic (
|
||||
"invalid state: attempt to analyze nil argument")
|
||||
panic("invalid state: attempt to analyze nil argument")
|
||||
|
||||
case parser.ArgumentKindPhrase:
|
||||
// TODO
|
||||
@ -41,10 +40,7 @@ func (analyzer AnalysisOperation) analyzeArgument (
|
||||
case parser.ArgumentKindSubscript:
|
||||
// TODO
|
||||
|
||||
case parser.ArgumentKindObjectDefaultValues:
|
||||
// TODO
|
||||
|
||||
case parser.ArgumentKindArrayDefaultValues:
|
||||
case parser.ArgumentKindList:
|
||||
// TODO
|
||||
|
||||
case parser.ArgumentKindIdentifier:
|
||||
@ -67,11 +63,6 @@ func (analyzer AnalysisOperation) analyzeArgument (
|
||||
|
||||
case parser.ArgumentKindRune:
|
||||
outputArgument = RuneLiteral(inputArgument.Value().(rune))
|
||||
|
||||
case parser.ArgumentKindOperator:
|
||||
panic (
|
||||
"invalid state: attempt to analyze operator argument " +
|
||||
"directly")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -9,6 +9,33 @@ type TypeSection struct {
|
||||
sectionBase
|
||||
what Type
|
||||
complete bool
|
||||
// TODO: do not add members from parent type. instead have a member
|
||||
// function to discern whether this type contains a particular member,
|
||||
// and have it recurse all the way up the family tree. it will be the
|
||||
// translator's job to worry about what members are placed where.
|
||||
members []ObjectMember
|
||||
}
|
||||
|
||||
// ObjectMember is a member of an object type.
|
||||
type ObjectMember struct {
|
||||
name string
|
||||
|
||||
// even if there is a private permission in another module, we still
|
||||
// need to include it in the semantic analysis because we need to know
|
||||
// how many members objects have.
|
||||
permission types.Permission
|
||||
|
||||
what Type
|
||||
}
|
||||
|
||||
func (member ObjectMember) ToString (indent int) (output string) {
|
||||
output += doIndent (
|
||||
indent,
|
||||
member.name, " ",
|
||||
member.permission.ToString(),
|
||||
"\n")
|
||||
output += member.what.ToString(indent + 1)
|
||||
return
|
||||
}
|
||||
|
||||
// ToString returns all data stored within the type section, in string form.
|
||||
@ -26,7 +53,8 @@ func (analyzer AnalysisOperation) analyzeTypeSection () (
|
||||
inputSection := analyzer.currentSection.(parser.TypeSection)
|
||||
if inputSection.Permission() == types.PermissionReadWrite {
|
||||
err = inputSection.NewError (
|
||||
"rw permission not understood in this context, try ro",
|
||||
"read-write (rw) permission not understood in this " +
|
||||
"context, try read-only (ro)",
|
||||
infoerr.ErrorKindError)
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package analyzer
|
||||
|
||||
import "git.tebibyte.media/arf/arf/types"
|
||||
// import "git.tebibyte.media/arf/arf/types"
|
||||
import "git.tebibyte.media/arf/arf/parser"
|
||||
import "git.tebibyte.media/arf/arf/infoerr"
|
||||
|
||||
@ -21,28 +21,6 @@ const (
|
||||
TypeKindObject
|
||||
)
|
||||
|
||||
// ObjectMember is a member of an object type.
|
||||
type ObjectMember struct {
|
||||
name string
|
||||
|
||||
// even if there is a private permission in another module, we still
|
||||
// need to include it in the semantic analysis because we need to know
|
||||
// how many members objects have.
|
||||
permission types.Permission
|
||||
|
||||
what Type
|
||||
}
|
||||
|
||||
func (member ObjectMember) ToString (indent int) (output string) {
|
||||
output += doIndent (
|
||||
indent,
|
||||
member.name, " ",
|
||||
member.permission.ToString(),
|
||||
"\n")
|
||||
output += member.what.ToString(indent + 1)
|
||||
return
|
||||
}
|
||||
|
||||
// Type represents a description of a type. It must eventually point to a
|
||||
// TypeSection.
|
||||
type Type struct {
|
||||
@ -57,14 +35,6 @@ type Type struct {
|
||||
// of whatever the type is. even if the type is a variable length array.
|
||||
// because literally why not.
|
||||
length uint64
|
||||
|
||||
// this is only applicable for a TypeKindObject where new members are
|
||||
// defined.
|
||||
// TODO: do not add members from parent type. instead have a member
|
||||
// function to discern whether this type contains a particular member,
|
||||
// and have it recurse all the way up the family tree. it will be the
|
||||
// translator's job to worry about what members are placed where.
|
||||
members []ObjectMember
|
||||
}
|
||||
|
||||
// ToString returns all data stored within the type, in string form.
|
||||
|
@ -69,8 +69,6 @@ func (parser *ParsingOperation) parseTypeSection () (
|
||||
section.members = append(section.members, member)
|
||||
if err != nil { return }
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// parseTypeSectionMember parses a type section member variable.
|
||||
|
@ -1,4 +1,4 @@
|
||||
:arf
|
||||
---
|
||||
|
||||
type basicInt:Int:<5>
|
||||
type ro basicInt:Int 5
|
||||
|
@ -39,7 +39,7 @@ func (iterator Iterator[VALUE_TYPE]) Value () (value VALUE_TYPE) {
|
||||
}
|
||||
|
||||
// Next advances the iterator by 1.
|
||||
func (iterator Iterator[VALUE_TYPE]) Next () {
|
||||
func (iterator *Iterator[VALUE_TYPE]) Next () {
|
||||
iterator.index ++
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user