# Path: symbol.py
# class VarRef(Expression):
# 	# A variable reference found in the token stream. Save as a nested set of
# 	# tuples representing a tree. 
# 	# $a			->  VarRef(a)
# 	# $(abc)		->  VarRef(abc,)
# 	# $(abc$(def))  ->  VarRef(abc,VarRef(def),)
# 	# $(abc$(def)$(ghi))  ->  VarRef(abc,VarRef(def),VarRef(ghi),)
# 	# $(abc$(def)$(ghi$(jkl)))  ->  VarRef(abc,VarRef(def),VarRef(ghi,VarRef(jkl)),)
# 	# $(abc$(def)xyz)		   ->  VarRef(abc,VarRef(def),Literal(xyz),)
# 	# $(info this is a varref)  ->  VarRef(info this is a varref)
# 
# 	def makefile(self):
# 		return "$(" + "".join([t.makefile() for t in self.token_list]) + ")"
# 
# 	def eval(self, symbol_table):
# 		s = ""
# 		for sym in self.token_list:
# #			print(type(sym), sym)
# 			value = sym.eval(symbol_table)
# #			print(type(value), value)
# 			ref = symbol_table.fetch(value)
# #			print(type(ref), ref)
# 			if isinstance(ref,Expression):
# 				# execute the expression
# 				ref_value = ref.eval(symbol_table)
# #				print(type(ref_value), ref_value)
# 				s += ref_value
# 			else:
# 				s += ref
# 		return s
# 
# class Literal(Symbol):
# 	# A literal found in the token stream. Store as a string.
# 	
# 	def eval(self, symbol_table):
# 		return printable_string(self.string)
# 
# Path: evaluate.py
# def evaluate(symbol_list, symbol_table):
# 	s = ""
# 	for sym in symbol_list:
# 		logger.debug("sym=%s", sym)
# 		s += sym.eval(symbol_table)
# 		logger.debug("eval result s=\"%s\"", s)
# 		logger.debug("symbol_table=%s", symbol_table)
# 	return s
# 
# Path: vline.py
# VCHAR_ROW = 0
# VCHAR_COL = 1
# def is_line_continuation(line):
# 	def __init__(self, char, pos, filename):
# 	def linenumber(self):
# 	def __str__(self):
# 	def __init__(self, arg=None):
# 	def __str__(self):
# 	def __add__(self, vchar):
# 	def __len__(self):
# 	def __getitem__(self, idx):
# 	def rstrip(self):
# 	def from_string(cls, python_string):
# 	def __init__(self, phys_lines_list, starts_at_file_line=-1, filename="/dev/null"):
# 	def _make_virtual_line(self):
# 	def _collapse_virtual_line(self):
# 	def __str__(self):
# 	def __iter__(self):
# 	def truncate(self, truncate_pos):
# 		def split_2d_array( splitme, row_to_split, col_to_split ):
# 	def starting_pos(self):
# 	def from_string(cls, python_string):
# 	def validate(vline_list):
# 	def get_phys_line(self):
# 	def python(self):
# 	def get_code(self):
# 	def _collapse_virtual_line(self):
# def get_vline(filename, line_iter): 
# class VChar(object):
# class VCharString(object):
# class VirtualLine(object):
# class RecipeVirtualLine(VirtualLine):


import sys
import logging
import shell
from symbol import VarRef, Literal
from evaluate import evaluate
from vline import VCharString, whitespace
from error import *
		  ]

# built-in functions GNU Make 3.81(ish?)
builtins = {
	"subst",
	"patsubst",
	"strip",
	"findstring",
	"filter",
	"filter-out",
	"sort",
	"word",
	"words",
	"wordlist",
	"firstword",
	"lastword",
	"dir",
	"notdir",
	"suffix",
	"basename",
	"addsuffix",
	"addprefix",
	"join",
	"wildcard",
	"realpath",
	"absname",
	"error",
	"warning",
	"shell",
	"origin",

# Path: symbol.py
# class VarRef(Expression):
# 	# A variable reference found in the token stream. Save as a nested set of
# 	# tuples representing a tree. 
# 	# $a			->  VarRef(a)
# 	# $(abc)		->  VarRef(abc,)
# 	# $(abc$(def))  ->  VarRef(abc,VarRef(def),)
# 	# $(abc$(def)$(ghi))  ->  VarRef(abc,VarRef(def),VarRef(ghi),)
# 	# $(abc$(def)$(ghi$(jkl)))  ->  VarRef(abc,VarRef(def),VarRef(ghi,VarRef(jkl)),)
# 	# $(abc$(def)xyz)		   ->  VarRef(abc,VarRef(def),Literal(xyz),)
# 	# $(info this is a varref)  ->  VarRef(info this is a varref)
# 
# 	def makefile(self):
# 		return "$(" + "".join([t.makefile() for t in self.token_list]) + ")"
# 
# 	def eval(self, symbol_table):
# 		s = ""
# 		for sym in self.token_list:
# #			print(type(sym), sym)
# 			value = sym.eval(symbol_table)
# #			print(type(value), value)
# 			ref = symbol_table.fetch(value)
# #			print(type(ref), ref)
# 			if isinstance(ref,Expression):
# 				# execute the expression
# 				ref_value = ref.eval(symbol_table)
# #				print(type(ref_value), ref_value)
# 				s += ref_value
# 			else:
# 				s += ref
# 		return s
# 
# class Literal(Symbol):
# 	# A literal found in the token stream. Store as a string.
# 	
# 	def eval(self, symbol_table):
# 		return printable_string(self.string)
# 
# Path: evaluate.py
# def evaluate(symbol_list, symbol_table):
# 	s = ""
# 	for sym in symbol_list:
# 		logger.debug("sym=%s", sym)
# 		s += sym.eval(symbol_table)
# 		logger.debug("eval result s=\"%s\"", s)
# 		logger.debug("symbol_table=%s", symbol_table)
# 	return s
# 
# Path: vline.py
# VCHAR_ROW = 0
# VCHAR_COL = 1
# def is_line_continuation(line):
# 	def __init__(self, char, pos, filename):
# 	def linenumber(self):
# 	def __str__(self):
# 	def __init__(self, arg=None):
# 	def __str__(self):
# 	def __add__(self, vchar):
# 	def __len__(self):
# 	def __getitem__(self, idx):
# 	def rstrip(self):
# 	def from_string(cls, python_string):
# 	def __init__(self, phys_lines_list, starts_at_file_line=-1, filename="/dev/null"):
# 	def _make_virtual_line(self):
# 	def _collapse_virtual_line(self):
# 	def __str__(self):
# 	def __iter__(self):
# 	def truncate(self, truncate_pos):
# 		def split_2d_array( splitme, row_to_split, col_to_split ):
# 	def starting_pos(self):
# 	def from_string(cls, python_string):
# 	def validate(vline_list):
# 	def get_phys_line(self):
# 	def python(self):
# 	def get_code(self):
# 	def _collapse_virtual_line(self):
# def get_vline(filename, line_iter): 
# class VChar(object):
# class VCharString(object):
# class VirtualLine(object):
# class RecipeVirtualLine(VirtualLine):


# Path: functions.py
import sys
import logging
import shell
from symbol import VarRef, Literal
from evaluate import evaluate
from vline import VCharString, whitespace
from error import *

		  ]

# built-in functions GNU Make 3.81(ish?)
builtins = {
	"subst",
	"patsubst",
	"strip",
	"findstring",
	"filter",
	"filter-out",
	"sort",
	"word",
	"words",
	"wordlist",
	"firstword",
	"lastword",
	"dir",
	"notdir",
	"suffix",
	"basename",
	"addsuffix",
	"addprefix",
	"join",
	"wildcard",
	"realpath",
	"absname",
	"error",
	"warning",
	"shell",
	"origin",

	"flavor",