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