Add tokens to startTokensExpression

This commit is contained in:
Sasha Koshka 2024-02-07 12:50:19 -05:00
parent a14df2bfbb
commit a80b6ad74e
1 changed files with 10 additions and 1 deletions

View File

@ -5,7 +5,12 @@ import "git.tebibyte.media/sashakoshka/fspl/entity"
var descriptionExpression = "Expression"
var startTokensExpression = []lexer.TokenKind {
// TODO
lexer.Ident,
lexer.LBracket,
lexer.LParen,
lexer.Int,
lexer.Float,
lexer.String,
}
func (this *Parser) parseExpression () (entity.Expression, error) {
@ -20,6 +25,10 @@ func (this *Parser) parseExpression () (entity.Expression, error) {
// 4. Repeat from step 2 if needed.
// 5. Return the expression, whether it was directly parsed or is a tree
// of infix operator(s).
err := this.expectDescription (
descriptionExpression,
startTokensDescription...)
if err != nil { return nil, err }
return nil, nil
}