am a4f6d228: Merge "Add a method for replacing tokens in the preprocessed headers"
* commit 'a4f6d2281f979c013080e28b1f658c2ba9a8e9f3': Add a method for replacing tokens in the preprocessed headers
This commit is contained in:
commit
4ad2f19f14
@ -1863,6 +1863,16 @@ class BlockList:
|
|||||||
tokens = tokens[:-1] # remove trailing tokLN
|
tokens = tokens[:-1] # remove trailing tokLN
|
||||||
self.blocks = [ Block(tokens) ] + self.blocks
|
self.blocks = [ Block(tokens) ] + self.blocks
|
||||||
|
|
||||||
|
def replaceTokens(self,replacements=dict()):
|
||||||
|
"""replace tokens according to the given dict
|
||||||
|
"""
|
||||||
|
for b in self.blocks:
|
||||||
|
if not b.isDirective():
|
||||||
|
for tok in b.tokens:
|
||||||
|
if tok.id == tokIDENT:
|
||||||
|
if tok.value in replacements:
|
||||||
|
tok.value = replacements[tok.value]
|
||||||
|
|
||||||
class BlockParser:
|
class BlockParser:
|
||||||
"""a class used to convert an input source file into a BlockList object"""
|
"""a class used to convert an input source file into a BlockList object"""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user