| 1 |
# SPDX-License-Identifier: Apache-2.0 |
| 2 |
# Copyright © 2024-2025 Intel Corporation |
| 3 |
|
| 4 |
project('flex and bison', 'c', meson_version : '>= 1.10.0') |
| 5 |
|
| 6 |
# The point of this test is that one generator |
| 7 |
# may output headers that are necessary to build |
| 8 |
# the sources of a different generator. |
| 9 |
|
| 10 |
flex = find_program('reflex', 'flex', 'lex', 'win_flex', required: false) |
| 11 |
if not flex.found() |
| 12 |
error('MESON_SKIP_TEST flex not found.') |
| 13 |
endif |
| 14 |
|
| 15 |
bison = find_program('bison', 'byacc', 'yacc', 'win_bison', required: false) |
| 16 |
if not bison.found() |
| 17 |
error('MESON_SKIP_TEST bison not found.') |
| 18 |
endif |
| 19 |
|
| 20 |
codegen = import('unstable-codegen') |
| 21 |
lex = codegen.lex() |
| 22 |
message('lex implementation:', lex.implementation()) |
| 23 |
lfiles = lex.generate('lexer.l', header: '@[email protected]') |
| 24 |
|
| 25 |
yacc = codegen.yacc() |
| 26 |
message('yacc implementation:', yacc.implementation()) |
| 27 |
pfiles = yacc.generate('parser.y', header : '@[email protected]') |
| 28 |
|
| 29 |
e = executable( |
| 30 |
'pgen', |
| 31 |
'prog.c', lfiles, pfiles, |
| 32 |
override_options : ['unity=off'], |
| 33 |
) |
| 34 |
|
| 35 |
test('parsertest', e, |
| 36 |
args: [meson.current_source_dir() / 'testfile']) |