Implemented assert keyword
This commit is contained in:
parent
f0a1b97f2d
commit
e4f041be41
14 changed files with 81 additions and 1 deletions
|
@ -35,6 +35,15 @@ func toASTNode(tokens token.List, buffer []byte) (Node, error) {
|
|||
return &Return{Value: value}, nil
|
||||
}
|
||||
|
||||
if tokens[0].Kind == token.Assert {
|
||||
if len(tokens) == 1 {
|
||||
return nil, errors.New(errors.MissingExpression, nil, tokens[0].End())
|
||||
}
|
||||
|
||||
condition := expression.Parse(tokens[1:])
|
||||
return &Assert{Condition: condition}, nil
|
||||
}
|
||||
|
||||
if keywordHasBlock(tokens[0].Kind) {
|
||||
blockStart := tokens.IndexKind(token.BlockStart)
|
||||
blockEnd := tokens.LastIndexKind(token.BlockEnd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue