9 from TaskGen import extension
11 bison = '${BISON} ${BISONFLAGS} ${SRC[0].abspath()} -o ${TGT[0].name}'
12 cls = Task.simple_task_type('bison', bison, 'GREEN', ext_in='.yc .y .yy', ext_out='.c .cxx .h .l', shell=False)
14 @extension(['.y', '.yc', '.yy'])
15 def big_bison(self, node):
16 """when it becomes complicated (unlike flex), the old recipes work better (cwd)"""
17 has_h = '-d' in self.env['BISONFLAGS']
20 if node.name.endswith('.yc'):
21 outs.append(node.change_ext('.tab.cc'))
23 outs.append(node.change_ext('.tab.hh'))
25 outs.append(node.change_ext('.tab.c'))
27 outs.append(node.change_ext('.tab.h'))
29 tsk = self.create_task('bison', node, outs)
30 tsk.cwd = node.bld_dir(tsk.env)
32 # and the c/cxx file must be compiled too
33 self.allnodes.append(outs[0])
36 bison = conf.find_program('bison', var='BISON', mandatory=True)
37 conf.env['BISONFLAGS'] = '-d'