projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gallivm: Use the LLVM's C disassembly interface.
[mesa.git]
/
scons
/
source_list.py
diff --git
a/scons/source_list.py
b/scons/source_list.py
index fbd3ef7dc17884fb2c3e44919892fe2e6346df94..e16d1f9b6d2b6a31dc387323a88fcf6df94ea2a4 100644
(file)
--- a/
scons/source_list.py
+++ b/
scons/source_list.py
@@
-3,7
+3,7
@@
The syntax of a source list file is a very small subset of GNU Make. These
features are supported
The syntax of a source list file is a very small subset of GNU Make. These
features are supported
- operators: +=, :=
+ operators:
=,
+=, :=
line continuation
non-nested variable expansion
comment
line continuation
non-nested variable expansion
comment
@@
-13,6
+13,7
@@
The goal is to allow Makefile's and SConscript's to share source listing.
class SourceListParser(object):
def __init__(self):
class SourceListParser(object):
def __init__(self):
+ self.symbol_table = {}
self._reset()
def _reset(self, filename=None):
self._reset()
def _reset(self, filename=None):
@@
-20,7
+21,6
@@
class SourceListParser(object):
self.line_no = 1
self.line_cont = ''
self.line_no = 1
self.line_cont = ''
- self.symbol_table = {}
def _error(self, msg):
raise RuntimeError('%s:%d: %s' % (self.filename, self.line_no, msg))
def _error(self, msg):
raise RuntimeError('%s:%d: %s' % (self.filename, self.line_no, msg))
@@
-62,20
+62,24
@@
class SourceListParser(object):
if op_pos < 0:
self._error('not a variable definition')
if op_pos < 0:
self._error('not a variable definition')
- if op_pos > 0 and line[op_pos - 1] in [':', '+']:
- op_pos -= 1
+ if op_pos > 0:
+ if line[op_pos - 1] in [':', '+', '?']:
+ op_pos -= 1
else:
else:
- self._error('only
:=
and += are supported')
+ self._error('only
=, :=,
and += are supported')
# set op, sym, and val
op = line[op_pos:op_end]
sym = line[:op_pos].strip()
val = self._expand_value(line[op_end:].lstrip())
# set op, sym, and val
op = line[op_pos:op_end]
sym = line[:op_pos].strip()
val = self._expand_value(line[op_end:].lstrip())
- if op
== ':='
:
+ if op
in ('=', ':=')
:
self.symbol_table[sym] = val
elif op == '+=':
self.symbol_table[sym] += ' ' + val
self.symbol_table[sym] = val
elif op == '+=':
self.symbol_table[sym] += ' ' + val
+ elif op == '?=':
+ if sym not in self.symbol_table:
+ self.symbol_table[sym] = val
def _parse_line(self, line):
"""Parse a source list line."""
def _parse_line(self, line):
"""Parse a source list line."""
@@
-121,3
+125,6
@@
class SourceListParser(object):
raise
return self.symbol_table
raise
return self.symbol_table
+
+ def add_symbol(self, name, value):
+ self.symbol_table[name] = value