What is anything anymore
This commit is contained in:
parent
dfa7d31163
commit
befe371e4f
@ -58,7 +58,7 @@ func (analyzer *analysisOperation) analyze () (err error) {
|
|||||||
for !sections.End() {
|
for !sections.End() {
|
||||||
_, err = analyzer.fetchSection(locator {
|
_, err = analyzer.fetchSection(locator {
|
||||||
modulePath: analyzer.modulePath,
|
modulePath: analyzer.modulePath,
|
||||||
name: sections.Value().Name(),
|
name: sections.Key(),
|
||||||
})
|
})
|
||||||
if err != nil { return err }
|
if err != nil { return err }
|
||||||
sections.Next()
|
sections.Next()
|
||||||
@ -93,7 +93,7 @@ func (analyzer *analysisOperation) fetchSection (
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var parsedSection = tree.LookupSection(where.name)
|
var parsedSection = tree.LookupSection("", where.name)
|
||||||
if parsedSection == nil {
|
if parsedSection == nil {
|
||||||
section = nil
|
section = nil
|
||||||
return
|
return
|
||||||
|
@ -1,5 +1,31 @@
|
|||||||
package analyzer
|
package analyzer
|
||||||
|
|
||||||
|
import "git.tebibyte.media/arf/arf/parser"
|
||||||
|
|
||||||
|
// Block represents a scoped block of phrases.
|
||||||
type Block struct {
|
type Block struct {
|
||||||
locatable
|
locatable
|
||||||
|
phrases []Phrase
|
||||||
|
|
||||||
|
// TODO: create a scope struct and embed it
|
||||||
|
}
|
||||||
|
|
||||||
|
func (block Block) ToString (indent int) (output string) {
|
||||||
|
output += doIndent(indent, "block\n")
|
||||||
|
|
||||||
|
// TODO: variables
|
||||||
|
// TODO: phrases
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// analyzeBlock analyzes a scoped block of phrases.
|
||||||
|
// TODO: have a way to "start out" with a list of variables for things like
|
||||||
|
// arguments, and declarations inside of control flow statements
|
||||||
|
func (analyzer *analysisOperation) analyzeBlock (
|
||||||
|
inputBlock parser.Block,
|
||||||
|
) (
|
||||||
|
block Block,
|
||||||
|
err error,
|
||||||
|
) {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import "git.tebibyte.media/arf/arf/infoerr"
|
|||||||
// FuncSection represents a type definition section.
|
// FuncSection represents a type definition section.
|
||||||
type FuncSection struct {
|
type FuncSection struct {
|
||||||
sectionBase
|
sectionBase
|
||||||
|
root Block
|
||||||
external bool
|
external bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ func (section FuncSection) ToString (indent int) (output string) {
|
|||||||
output += "\n"
|
output += "\n"
|
||||||
|
|
||||||
// TODO: arguments
|
// TODO: arguments
|
||||||
// TODO: root block
|
output += section.root.ToString(indent + 1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +54,8 @@ func (analyzer *analysisOperation) analyzeFuncSection () (
|
|||||||
outputSection.external = true
|
outputSection.external = true
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
outputSection.root, err = analyzer.analyzeBlock(inputSection.Root())
|
||||||
|
if err != nil { return }
|
||||||
// TODO: analyze root block if not nil
|
// TODO: analyze root block if not nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,15 @@ import "git.tebibyte.media/arf/arf/types"
|
|||||||
// LookupSection looks returns the section under the give name. If the section
|
// LookupSection looks returns the section under the give name. If the section
|
||||||
// does not exist, nil is returned. If a method is being searched for, the type
|
// does not exist, nil is returned. If a method is being searched for, the type
|
||||||
// name of its receiver should be passed. If not, it should just be left blank.
|
// name of its receiver should be passed. If not, it should just be left blank.
|
||||||
func (tree SyntaxTree) LookupSection (name string) (section Section) {
|
func (tree SyntaxTree) LookupSection (
|
||||||
|
receiver string,
|
||||||
|
name string,
|
||||||
|
) (
|
||||||
|
section Section,
|
||||||
|
) {
|
||||||
|
if receiver != "" {
|
||||||
|
name = receiver + "_" + name
|
||||||
|
}
|
||||||
section = tree.sections[name]
|
section = tree.sections[name]
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user