Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Aug 18, 2024
1 parent 8750d61 commit 291505b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (p *parser) statements(end Token) Block {
return statements
}

// statement = if | while | for | return | func | assign | expression
// statement = if | while | for | return | function | assign | expression
// assign = NAME ASSIGN expression |
//
// call subscript ASSIGN expression |
Expand Down Expand Up @@ -378,6 +378,8 @@ func (p *parser) primary() Expression {
pos := p.pos
p.next()
// TODO
//print("->")
//print(p.val)
//p.expect(SEMI)
return &Literal{pos, val}
case TRUE:
Expand Down Expand Up @@ -412,7 +414,7 @@ func (p *parser) primary() Expression {
formatter := prettyjson.NewFormatter()
output, _ := formatter.Marshal(p.val)
fmt.Println(string(output))
p.error("expected expression, not %s val %s", p.tok, p.val)
p.error("expected expression, ___%s___ ", p.tok)
return nil
}
}
Expand Down
5 changes: 4 additions & 1 deletion tests/all-syntax-variations.davi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

// This is a comment

$test = "Test"


echo("Time is:");
echo(time());

Expand All @@ -23,7 +26,7 @@ echo $calculationHandler();
echo time();


// Foreach loop
// For loop
$list = ["Bozhidar", "Veselinov", "Slaveykov", "Asenov"];
sort($list);
echo($list);
Expand Down

0 comments on commit 291505b

Please sign in to comment.