summaryrefslogtreecommitdiff
path: root/src/tparse/tree-preproc.go
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2021-08-30 19:07:26 -0400
committerKyle Gunger <kgunger12@gmail.com>2021-08-30 19:07:26 -0400
commitea5ef2fe245c09b35c783977928d6e995110cfb4 (patch)
treee25f71adb433bba34b10c3a013d8b10c24f159e3 /src/tparse/tree-preproc.go
parent628dd83397c47ff484f7c81b06dcd6d1e4af628b (diff)
Scrap old spec, add initial value parsing
Diffstat (limited to 'src/tparse/tree-preproc.go')
-rw-r--r--src/tparse/tree-preproc.go49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/tparse/tree-preproc.go b/src/tparse/tree-preproc.go
new file mode 100644
index 0000000..d0f6637
--- /dev/null
+++ b/src/tparse/tree-preproc.go
@@ -0,0 +1,49 @@
+/*
+ Copyright 2020 Kyle Gunger
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package tparse
+
+func parsePreBlock (tokens *[]Token, tok, max int) (Node, int) {
+ out := Node{IsBlock: true}
+ out.Data = Token{Type: 11, Data: (*tokens)[tok].Data}
+
+ tok++
+
+ for ; tok < max; tok++ {
+ t := (*tokens)[tok]
+
+ if t.Data == ":/" {
+ break
+ }
+
+ tmp := Node{Data: t, IsBlock: false}
+ out.Sub = append(out.Sub, tmp)
+ }
+
+ return out, tok
+}
+
+func parsePre (tokens *[]Token, tok, max int) (Node, int) {
+ out := Node{IsBlock: false}
+ out.Data = Token{Type: 11, Data: (*tokens)[tok].Data}
+
+ tok++
+
+ tmp := Node{Data: (*tokens)[tok], IsBlock: false}
+ out.Sub = append(out.Sub, tmp)
+
+ return out, tok
+} \ No newline at end of file