Qbs Manual | List of Modules | Module lex_yacc

Qbs 1.8.0

# Module lex_yacc

The `lex_yacc` module allows you to create scanners and parsers via the POSIX tools `lex` and `yacc`, respectively. These tools are closely related and share a number of properties, which is why they are represented by a single module.

## General Properties

Property | Type | Since | Default | Description
--- | --- | --- | --- | ---
enableCompilerWarnings | `bool` | 1.8 | `false` | Because `lex` and `yacc` are known to produce files that will trigger compiler warnings, such warnings are suppressed by default. Set this property to `true` if you want to see them.
lexBinary | `string` | 1.6 | `"lex"` | The file path of the `lex` tool.
lexFlags | `stringList` | 1.6 | `empty` | Additional command-line options for the `lex` tool.
outputTag | `string` | 1.6 | `"c"` | The file tag for the generated scanner and parser sources. Use `"cpp"` if you want to use a C++ compiler on them.
uniqueSymbolPrefix | `bool` | 1.6 | `false` | If this property is `true`, the normal prefix `yy` used for the generated lexer and parser functions will be replaced by the base name of the file provided as input to `lex` and `yacc`, respectively. Enable this property if you want to use more than one lexer or parser in a single product.

Note: Enabling this property requires associated lexer and scanner source files to have the same base name. It also assumes a variant of `lex` that supports the non-POSIX option `-P`, such as `flex`.

yaccBinary | `string` | 1.6 | `"yacc"` | The file path of the `yacc` tool.
yaccFlags | `stringList` | 1.6 | `empty` | Additional command-line options for the `yacc` tool.

## Relevant File Tags

Tag | Auto-tagged File Names | Since | Description
--- | --- | --- | ---
`"lex.input"` | `*.l` | 1.6 | Source files with this tag serve as inputs to the `lex` tool.
`"yacc.input"` | `*.y` | 1.6 | Source files with this tag serve as inputs to the `yacc` tool.