diff options
author | peter klausler <pklausler@nvidia.com> | 2018-04-25 13:34:40 -0700 |
---|---|---|
committer | peter klausler <pklausler@nvidia.com> | 2018-04-25 14:16:15 -0700 |
commit | 6a0acd8505f8aba1c5bea2c1dc8e0123c51655d9 (patch) | |
tree | d15ddf6eadb9dc149690b5a5c57c42ba373a2e11 /flang/documentation | |
parent | 9e94216abe7774b2816beec55a067d0cdd8f8cc3 (diff) | |
download | llvm-6a0acd8505f8aba1c5bea2c1dc8e0123c51655d9.tar.gz |
[flang] Implement first(...) as attempt at a faster set of alternatives.
Original-commit: flang-compiler/f18@9f6a26cee636c3cc91d91583fd2b785f26a618c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false
Diffstat (limited to 'flang/documentation')
-rw-r--r-- | flang/documentation/ParserCombinators.md | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/flang/documentation/ParserCombinators.md b/flang/documentation/ParserCombinators.md index 7158598efda2..21629edd0d2a 100644 --- a/flang/documentation/ParserCombinators.md +++ b/flang/documentation/ParserCombinators.md @@ -62,6 +62,10 @@ They are `constexpr`, so they should be viewed as type-safe macros. * `p || q` succeeds if p does, otherwise running q. The two parsers must have the same type, and the value returned by the first succeeding parser is the value of the combination. +* `first(p1, p2, ...)` returns the value of the first parser that succeeds. + All of the parsers in the list must return the same type. + It is essentially the same as `p1 || p2 || ...` but has a slightly + faster implementation and may be easier to format in your code. * `lookAhead(p)` succeeds if p does, but doesn't modify any state. * `attempt(p)` succeeds if p does, safely preserving state on failure. * `many(p)` recognizes a greedy sequence of zero or more nonempty successes |