mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-22 06:02:18 +02:00
lex: add examples and add {Free,Net,Open}BSD pages (#11895)
* lex: add examples and add other BSD * lex: fix OpenBSD man link * lex: remove unsupported option from OpenBSD * lex: apply suggestions from code review Co-authored-by: Juri Dispan <juri.dispan@posteo.net> Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com> * flex, lex: moving flex options to common/flex.md * lex: mention `lex` alias to `flex` * Update pages/linux/lex.md --------- Co-authored-by: Juri Dispan <juri.dispan@posteo.net> Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
This commit is contained in:
parent
0c1893ff8e
commit
c19a39c1d4
4 changed files with 25 additions and 24 deletions
|
@ -1,17 +1,26 @@
|
|||
# flex
|
||||
|
||||
> Lexical analyzer generator. Based on `lex`.
|
||||
> Lexical analyzer generator. A rewrite of `lex` with extensions to the POSIX specification.
|
||||
> Given the specification for a lexical analyzer, generates C code implementing it.
|
||||
> NOTE: long options don't work on OpenBSD.
|
||||
> More information: <https://manned.org/flex>.
|
||||
|
||||
- Generate an analyzer from a flex file:
|
||||
- Generate an analyzer from a flex file, storing it to the file `lex.yy.c`:
|
||||
|
||||
`flex {{analyzer.l}}`
|
||||
`lex {{analyzer.l}}`
|
||||
|
||||
- Write analyzer to `stdout`:
|
||||
|
||||
`lex -{{-stdout|t}} {{analyzer.l}}`
|
||||
|
||||
- Specify the output file:
|
||||
|
||||
`flex --outfile {{analyzer.c}} {{analyzer.l}}`
|
||||
`lex {{analyzer.l}} -o {{analyzer.c}}`
|
||||
|
||||
- Compile a C file generated by flex:
|
||||
- Generate a [B]atch scanner instead of an interactive scanner:
|
||||
|
||||
`lex -B {{analyzer.l}}`
|
||||
|
||||
- Compile a C file generated by Lex:
|
||||
|
||||
`cc {{path/to/lex.yy.c}} --output {{executable}}`
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
|
||||
> Lexical analyzer generator.
|
||||
> Given the specification for a lexical analyzer, generates C code implementing it.
|
||||
> NOTE: on most major OSes, this command is an alias for `flex`.
|
||||
> More information: <https://manned.org/lex.1>.
|
||||
|
||||
- Generate an analyzer from a Lex file:
|
||||
- Generate an analyzer from a Lex file, storing it to the file `lex.yy.c`:
|
||||
|
||||
`lex {{analyzer.l}}`
|
||||
|
||||
|
|
|
@ -4,14 +4,22 @@
|
|||
> Given the specification for a lexical analyzer, generates C code implementing it.
|
||||
> More information: <https://manned.org/lex.1>.
|
||||
|
||||
- Generate an analyzer from a Lex file:
|
||||
- Generate an analyzer from a Lex file, storing it to the file `lex.yy.c`:
|
||||
|
||||
`lex {{analyzer.l}}`
|
||||
|
||||
- Write analyzer to `stdout`:
|
||||
|
||||
`lex -{{-stdout|t}} {{analyzer.l}}`
|
||||
|
||||
- Specify the output file:
|
||||
|
||||
`lex {{analyzer.l}} --outfile {{analyzer.c}}`
|
||||
|
||||
- Generate a [B]atch scanner instead of an interactive scanner:
|
||||
|
||||
`lex -B {{analyzer.l}}`
|
||||
|
||||
- Compile a C file generated by Lex:
|
||||
|
||||
`cc {{path/to/lex.yy.c}} --output {{executable}}`
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
# lex
|
||||
|
||||
> Lexical analyzer generator.
|
||||
> Given the specification for a lexical analyzer, generates C code implementing it.
|
||||
> More information: <https://keith.github.io/xcode-man-pages/lex.1.html>.
|
||||
|
||||
- Generate an analyzer from a Lex file:
|
||||
|
||||
`lex {{analyzer.l}}`
|
||||
|
||||
- Specify the output file:
|
||||
|
||||
`lex {{analyzer.l}} --outfile {{analyzer.c}}`
|
||||
|
||||
- Compile a C file generated by Lex:
|
||||
|
||||
`cc {{path/to/lex.yy.c}} --output {{executable}}`
|
Loading…
Add table
Reference in a new issue