- Add a set of canned PathOption validators: PathExists (the default),
PathIsFile, PathIsDir and PathIsDirCreate.
+ From Matthew Doar:
+
+ - Add support for .lex and .yacc file suffixes for Lex and Yacc files.
+
From Eric Frias:
- Huge performance improvement: wrap the tuples representing an
c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
c_file.add_action('.l', SCons.Defaults.LexAction)
+ c_file.add_action('.lex', SCons.Defaults.LexAction)
cxx_file.add_action('.ll', SCons.Defaults.LexAction)
env['LEX'] = env.Detect('flex') or 'lex'
c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
c_file.add_action('.y', SCons.Defaults.YaccAction)
+ c_file.add_action('.yacc', SCons.Defaults.YaccAction)
cxx_file.add_action('.yy', SCons.Defaults.YaccAction)
c_file.add_emitter('.y', yEmitter)
+ c_file.add_emitter('.yacc', yEmitter)
cxx_file.add_emitter('.yy', yyEmitter)
env['YACC'] = env.Detect('bison') or 'yacc'
test.write('SConstruct', """
env = Environment(LEX = r'%s mylex.py', tools=['default', 'lex'])
env.Program(target = 'aaa', source = 'aaa.l')
+env.Program(target = 'bbb', source = 'bbb.lex')
""" % python)
test.write('aaa.l', r"""
}
""")
-test.run(arguments = 'aaa' + _exe, stderr = None)
+test.write('bbb.lex', r"""
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ printf("LEX\n");
+ printf("bbb.lex\n");
+ exit (0);
+}
+""")
+
+test.run(arguments = '.', stderr = None)
test.run(program = test.workpath('aaa' + _exe), stdout = "mylex.py\naaa.l\n")
+test.run(program = test.workpath('bbb' + _exe), stdout = "mylex.py\nbbb.lex\n")
test.write('SConstruct', """
env = Environment(YACC = r'%s myyacc.py', tools=['default', 'yacc'])
env.Program(target = 'aaa', source = 'aaa.y')
+env.Program(target = 'bbb', source = 'bbb.yacc')
""" % python)
test.write('aaa.y', r"""
}
""")
-test.run(arguments = 'aaa' + _exe, stderr = None)
+test.write('bbb.yacc', r"""
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ printf("YACC\n");
+ printf("bbb.yacc\n");
+ exit (0);
+}
+""")
+
+test.run(arguments = '.', stderr = None)
test.run(program = test.workpath('aaa' + _exe), stdout = "myyacc.py\naaa.y\n")
+test.run(program = test.workpath('bbb' + _exe), stdout = "myyacc.py\nbbb.yacc\n")