From fae8bedfa9aca57204b40e46885a764e7637c2d8 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 11 Oct 2022 11:31:44 -0400 Subject: [PATCH] Dereference parsing stub --- parser/argument.go | 9 +++++++-- parser/dereference.go | 12 ++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 parser/dereference.go diff --git a/parser/argument.go b/parser/argument.go index 1185ec0..d07792e 100644 --- a/parser/argument.go +++ b/parser/argument.go @@ -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() diff --git a/parser/dereference.go b/parser/dereference.go new file mode 100644 index 0000000..ce132cf --- /dev/null +++ b/parser/dereference.go @@ -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 +}