Qbs Manual

Qbs 1.12.1

# lex_yacc

Provides support for the `lex` and `yacc` tools. More...

Since: | Qbs 1.6

- List of all members, including inherited members

## Properties

- enableCompilerWarnings : bool
- lexBinary : string
- lexFlags : stringList
- lexOutputFilePath : string
- outputTag : string
- uniqueSymbolPrefix : bool
- yaccBinary : string
- yaccFlags : stringList
- yaccOutputFilePath : string

## Detailed Description

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.

### 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.

## Property Documentation

enableCompilerWarnings : bool

Whether compiler warnings are displayed.

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.

Default: `false`

This QML property was introduced in Qbs 1.8.

lexBinary : string

The file path of the `lex` tool.

Default: `"lex"`

lexFlags : stringList

Additional command-line options for the `lex` tool.

Default: `[]`

lexOutputFilePath : string

The output file for the `lex` tool.

This corresponds to `%option outfile` in the .l file. If `%option outfile` is set in the .l file then this property is ignored.

Default: `undefined`

This QML property was introduced in Qt 1.12.

outputTag : string

The file tag for the generated scanner and parser sources.

Use "cpp" if you want to use a C++ compiler on them.

Default: "c"

uniqueSymbolPrefix : bool

If this property is `true`, the prefix `yy` normally used for the generated lexer and parser functions is 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 that the associated lexer and scanner source files have the same base name. It also assumes a variant of `lex` that supports the non-POSIX option `-P`, such as `flex`.

Default: `false`

yaccBinary : string

The file path of the `yacc` tool.

Default: `"yacc"`

yaccFlags : stringList

Additional command-line options for the `yacc` tool.

Default: `[]`

yaccOutputFilePath : string

Main output file for the `yacc` tool.

This corresponds to `%output` in the .y file. If `%output` is set in the .y file then this property is ignored.

Default: `undefined`

This QML property was introduced in Qt 1.12.