Re: yacc vs bison

Pierre-Luc Boily <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <[email protected]>
Thx,

I ended up doing this :
def yaccing(env, source):
    """ Generate c file and header file from yacc file.  """
    if str(source).endswith('.y'):
        env['YACC'] = 'yacc'  # By default, scons use Bison tool for yaccing
file.  Change the tool for yacc
        return
env.CFile(target=env.create_target_name(env.get_filename(str(source))),
                         source=source)
    else:
        print(str(source) + ' is not a yacc file.')
        exit(1)

Regarding your comment about overwriting the FLAGS, I agree with you.  But I
do have a strange behavior, probably something I do not understand about
scons yet (or just another stupid mistake).  See my Sconscript : 

env['YACCFLAGS'] = ['-t', '-p', 'atc_co_', '-d']
env['LEXFLAGS'] = ['-Patc_co_']
env.lexing('atc_co_lex.l')
env.yaccing('atc_co_yacc.y')

env['YACCFLAGS'] = ['-t', '-p', 'atc_db_', '-d']
env['LEXFLAGS'] = ['-Patc_db_']
env.lexing('atc_db_lex.l')
env.yaccing('atc_db_yacc.y')

This gives this output :
flex -Patc_db_ -t atm_common/libdb/src/atc_co_lex.l >
build/atm_common/libdb/src/linux.x86.debug/atc_co_lex.c
yacc -t -p atc_db_ -d -o
build/atm_common/libdb/src/linux.x86.debug/atc_co_yacc.c
atm_common/libdb/src/atc_co_yacc.y
flex -Patc_db_ -t atm_common/libdb/src/atc_db_lex.l >
build/atm_common/libdb/src/linux.x86.debug/atc_db_lex.c
yacc -t -p atc_db_ -d -o
build/atm_common/libdb/src/linux.x86.debug/atc_db_yacc.c
atm_common/libdb/src/atc_db_yacc.y

As you can see only "atc_db_" is used as flags.  I think a workaround could
be to clone two environments, but I feel I do something wrong.




--
Sent from: http://scons.1086193.n5.nabble.com/Users-f16930.html
_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.