diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2021-12-03 18:25:03 -0500 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2021-12-03 18:25:03 -0500 |
commit | 1100ac865074effb3a4735c7449779f7193b7d0c (patch) | |
tree | 1a981ae33b1ba4a888c98640fed0e7fc74b18f57 /src/texec/eval.go | |
parent | 8fd930180e5d7a610117299bb9c48e28409d3106 (diff) |
General updates
+ Fill out eval a little and make sure that this builds.
~ CF kinda broken in AST. Gonna have to fix that. Upcoming Parser update.
Diffstat (limited to 'src/texec/eval.go')
-rw-r--r-- | src/texec/eval.go | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/src/texec/eval.go b/src/texec/eval.go index 93cbfdb..0542a97 100644 --- a/src/texec/eval.go +++ b/src/texec/eval.go @@ -160,6 +160,43 @@ func equateType(a, b TType) bool { // Generate a TType from a 'type' node func getType(t tparse.Node) TType { out := TType{} + i := 0 + + // Pre + for ; i < len(t.Sub); i++ { + if t.Sub[i].Data.Type == tparse.DEFWORD || t.Sub[i].Data.Type == tparse.KEYTYPE { + break + } else { + out.Pre = append(out.Pre, t.Sub[i].Data.Data) + } + } + + // T + for ; i < len(t.Sub); i++ { + if t.Sub[i].Data.Type == tparse.KEYTYPE { + out.T.Name = t.Sub[i].Data.Data + i++ + break + } else if t.Sub[i].Data.Type == tparse.DEFWORD { + if i < len(t.Sub) - 1 { + if t.Sub[i + 1].Data.Type == tparse.DEFWORD { + out.T.Path = append(out.T.Path, t.Sub[i].Data.Data) + } else { + out.T.Name = t.Sub[i].Data.Data + break + } + } else { + out.T.Name = t.Sub[i].Data.Data + } + } + } + + // Post + if i < len(t.Sub) { + if t.Sub[i].Data.Data == "`" { + out.Post = "`" + } + } return out } @@ -167,20 +204,20 @@ func getType(t tparse.Node) TType { // Value generation func getStringLiteral(v tparse.Node) []byte { - + return []byte{} } func getCharLiteral(v tparse.Node) byte { - + return 0 } func getIntLiteral(v tparse.Node) int { - + return 0 } // Get a literal value from nodes. Must specify type of literal to generate. func getLiteral(v tparse.Node, t TType) interface{} { - + return 0 } //################# |