Added base parse body function

This commit is contained in:
Sasha Koshka 2022-08-14 22:38:57 -04:00
parent 8f42fa9c2a
commit 0a067524ce
5 changed files with 57 additions and 0 deletions

18
parser/body.go Normal file
View File

@ -0,0 +1,18 @@
package parser
import "git.tebibyte.media/sashakoshka/arf/lexer"
// parse body parses the body of an arf file, after the metadata header.
func (parser *ParsingOperation) parseBody () (err error) {
err = parser.nextToken(lexer.TokenKindName)
if err != nil { return }
switch parser.token.Value().(string) {
case "data":
case "type":
case "func":
case "face":
}
return
}

6
parser/data.go Normal file
View File

@ -0,0 +1,6 @@
package parser
// parseData parses a data section
func (parser *ParsingOperation) parseData () (err error) {
}

View File

@ -12,6 +12,9 @@ func (parser *ParsingOperation) parseMeta () (err error) {
if err != nil { return }
if parser.token.Is(lexer.TokenKindSeparator) {
err = parser.nextToken(lexer.TokenKindNewline)
if err != nil { return }
err = parser.nextToken()
return
}

View File

@ -64,6 +64,9 @@ func (parser *ParsingOperation) parse (sourceFile *file.File) (err error) {
err = parser.parseMeta()
if err != nil { return }
err = parser.parseBody()
if err != nil { return }
return
}

View File

@ -0,0 +1,27 @@
:arf
---
data wr integer:Int 3202
data wr integerPointer:{Int}
# TODO: data wr integerPointer:{Int} [& integer]
data wr integerArray16:{Int 16}
data wr integerArrayVariable:{Int ...}
data wr integerArrayInitialized:{Int 16}
3948 293 293049 948 912
340 0 2304 0 4785 92
data wr object:Obj
: this 324
: that 2139
data wr nestedObject:Obj
: this
: bird0 324
: bird1 "hello world"
: that
: bird2 123.8439
: bird3 9328.21348239