Dereference parsing stub

This commit is contained in:
Sasha Koshka 2022-10-11 11:31:44 -04:00
parent 1cd7511ced
commit fae8bedfa9
2 changed files with 19 additions and 2 deletions

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
}