# 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 *
		for t in self.token_list:
			print(t)

		# Walk along the token list looking for Literals which should contain
		# the commas.  Inside the literal(s), look for our comma(s).
		# Split the Literal into new Literals around the commas.
		# Preserve everything else as-is.
		token_iter = iter(self.token_list)
		for t in token_iter:
			if not isinstance(t, Literal):
				# no touchy
				self.args[arg_idx].append(t)
				continue

			# peek inside the literal for commas 
			lit = []
			str_iter = iter(t.string)
			for vchar in str_iter:
				# looking for commas separating the args
				if vchar.char != ',':
					# consume leading whitespace
					if arg_idx == 0 and vchar.char in whitespace:
						pass
					else:
						lit.append(vchar)
					continue

				logger.debug("found comma idx=%d", arg_idx)
				if lit:
					# save whatever we've seen so far (if anything)

# 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 *

		for t in self.token_list:
			print(t)

		# Walk along the token list looking for Literals which should contain
		# the commas.  Inside the literal(s), look for our comma(s).
		# Split the Literal into new Literals around the commas.
		# Preserve everything else as-is.
		token_iter = iter(self.token_list)
		for t in token_iter:
			if not isinstance(t, Literal):
				# no touchy
				self.args[arg_idx].append(t)
				continue

			# peek inside the literal for commas 
			lit = []
			str_iter = iter(t.string)
			for vchar in str_iter:
				# looking for commas separating the args
				if vchar.char != ',':
					# consume leading whitespace
					if arg_idx == 0 and vchar.char in whitespace:
						pass
					else:
						lit.append(vchar)
					continue

				logger.debug("found comma idx=%d", arg_idx)
				if lit:
					# save whatever we've seen so far (if anything)

					self.args[arg_idx].append(Literal(VCharString(lit)))