Add dereference parsing #17

Merged
sashakoshka merged 7 commits from parse-dereferences into main 2022-10-11 11:37:40 -06:00
2 changed files with 19 additions and 2 deletions
Showing only changes of commit fae8bedfa9 - Show all commits

View File

@ -3,7 +3,7 @@ package parser
import "git.tebibyte.media/arf/arf/lexer"
import "git.tebibyte.media/arf/arf/infoerr"
// TODO: add support for dereferences and subscripts
// TODO: add support for dereferences and subscripts (currently being worked on)
var validArgumentStartTokens = []lexer.TokenKind {
lexer.TokenKindName,
@ -14,6 +14,7 @@ var validArgumentStartTokens = []lexer.TokenKind {
lexer.TokenKindString,
lexer.TokenKindLBracket,
lexer.TokenKindLBrace,
lexer.TokenKindLParen,
}
@ -78,9 +79,13 @@ func (parser *ParsingOperation) parseArgument () (argument Argument, err error)
parser.nextToken()
case lexer.TokenKindLBracket:
argument.kind = ArgumentKindPhrase
argument.kind = ArgumentKindPhrase
argument.value, err = parser.parseArgumentLevelPhrase()
case lexer.TokenKindLBrace:
argument.kind = ArgumentKindDereference
argument.value, err = parser.parseDereference()
case lexer.TokenKindLParen:
argument.kind = ArgumentKindList
argument.value, err = parser.parseList()

12
parser/dereference.go Normal file
View File

@ -0,0 +1,12 @@
package parser
// import "git.tebibyte.media/arf/arf/lexer"
// import "git.tebibyte.media/arf/arf/infoerr"
func (parser *ParsingOperation) parseDereference () (
dereference Dereference,
err error,
) {
// TODO
return
}