implement-modules #43
@ -65,8 +65,8 @@ func (this *Parser) parseExpressionRootIdent () (entity.Expression, error) {
|
|||||||
return this.parseDeclarationCore(pos, name)
|
return this.parseDeclarationCore(pos, name)
|
||||||
} else {
|
} else {
|
||||||
switch name {
|
switch name {
|
||||||
case "true", "false": // TODO
|
case "true", "false": return this.parseLiteralBoolean ()
|
||||||
case "nil": // TODO
|
case "nil": return this.parseLiteralNil()
|
||||||
case "if": // TODO
|
case "if": // TODO
|
||||||
case "loop": // TODO
|
case "loop": // TODO
|
||||||
default: return this.parseVariable()
|
default: return this.parseVariable()
|
||||||
@ -150,3 +150,24 @@ func (this *Parser) parseLiteralString () (*entity.LiteralString, error) {
|
|||||||
ValueUTF8: this.value(),
|
ValueUTF8: this.value(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Parser) parseLiteralBoolean () (*entity.LiteralBoolean, error) {
|
||||||
|
err := this.expectValueDesc("Boolean", lexer.Ident, "true", "false")
|
||||||
|
if err != nil { return nil, err }
|
||||||
|
defer this.next()
|
||||||
|
|
||||||
|
return &entity.LiteralBoolean {
|
||||||
|
Position: this.pos(),
|
||||||
|
Value: this.value() == "true",
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Parser) parseLiteralNil () (*entity.LiteralNil, error) {
|
||||||
|
err := this.expectValueDesc("Boolean", lexer.Ident, "nil")
|
||||||
|
if err != nil { return nil, err }
|
||||||
|
defer this.next()
|
||||||
|
|
||||||
|
return &entity.LiteralNil {
|
||||||
|
Position: this.pos(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user