government / ast / builtin.go

@ 2dbe47969d09d4856796bbf662b4e11c74a7f4fe | history


package ast

import "government/builtin"

// The structural and constant builtins' names, from package builtin.
const (
	ListNode = builtin.ListNode
	Dot      = builtin.Dot
	True     = builtin.True
	False    = builtin.False
	Empty    = builtin.Empty
)

// IsBuiltin reports whether name is in namespace 0.
func IsBuiltin(name string) bool {
	_, ok := builtin.Lookup(name)
	return ok
}

// isReservedSymbol reports whether a source symbol names a builtin, and so
// goes in namespace 0. The structural names never come out of the reader
// as symbols; if one did, it must stay a symbol rather than turn into
// structure.
func isReservedSymbol(name string) bool {
	return builtin.IsReserved(name)
}