# Path: symtable.py
# class SymbolTable(object):
# 	def __init__(self):
# 		self.symbols = {}
# 
# 	def add(self, name, value):
# 		logger.debug("%s store \"%s\"=\"%s\"", self, name, value)
# 
# 		# an attempt to store empty string is a bug
# 		assert len(name)
# 
# 		self.symbols[name] = value
# 
# 	def fetch(self, s):
# 		# now try a var lookup 
# 		# Will always return an empty string on any sort of failure. 
# 		logger.debug("fetch sym=\"%s\"", s)
# 		if not len(s):
# 			return ""
# 		try:
# 			return self.symbols[s]
# 		except KeyError:
# 			logger.debug("sym=%s not in symbol table", s)
# 			# try environment
# 			value = os.getenv(s)
# 			if value is None:
# 				return ""
# 			logger.debug("sym=%s found in environ", s)
# 			return value


import sys
import logging
from symbol import *
from functions import *
from symtable import SymbolTable
#!/usr/bin/env python3

# davep 20-Mar-2016 ; symbol table



logger = logging.getLogger("pymake.test_symtable")

def test_all():
	symtable = SymbolTable()

	logger.debug("functions=%s", symtable.functions)

	thing = symtable.fetch("info hello, world")
	assert thing, "info"
	s = thing.eval(symtable)
	assert len(s)==0
	assert isinstance(thing, Info)


# Path: symtable.py
# class SymbolTable(object):
# 	def __init__(self):
# 		self.symbols = {}
# 
# 	def add(self, name, value):
# 		logger.debug("%s store \"%s\"=\"%s\"", self, name, value)
# 
# 		# an attempt to store empty string is a bug
# 		assert len(name)
# 
# 		self.symbols[name] = value
# 
# 	def fetch(self, s):
# 		# now try a var lookup 
# 		# Will always return an empty string on any sort of failure. 
# 		logger.debug("fetch sym=\"%s\"", s)
# 		if not len(s):
# 			return ""
# 		try:
# 			return self.symbols[s]
# 		except KeyError:
# 			logger.debug("sym=%s not in symbol table", s)
# 			# try environment
# 			value = os.getenv(s)
# 			if value is None:
# 				return ""
# 			logger.debug("sym=%s found in environ", s)
# 			return value


# Path: test_symtable.py
import sys
import logging
from symbol import *
from functions import *
from symtable import SymbolTable

#!/usr/bin/env python3

# davep 20-Mar-2016 ; symbol table



logger = logging.getLogger("pymake.test_symtable")

def test_all():
	symtable = SymbolTable()

	logger.debug("functions=%s", symtable.functions)

	thing = symtable.fetch("info hello, world")
	assert thing, "info"
	s = thing.eval(symtable)
	assert len(s)==0
	assert isinstance(thing, Info)


	symtable.add("a",Literal("10"))