From 76b8de9e59f068cdb3b809bd1e2430d372c6b7a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 8 Nov 2023 18:52:54 +0100 Subject: [PATCH] Mark `lexy::parse_tree_input` and `lexy::dsl::tnode/pnode` as experimental --- CHANGELOG.adoc | 2 +- docs/assets/css/style.scss | 11 +++++++++-- docs/assets/examples/parse_tree_parsing.cpp | 1 + docs/assets/icons/beta.svg | 4 +++- docs/content/learn/build.adoc | 4 +++- docs/content/learn/versioning.adoc | 2 +- docs/content/reference/dsl/parse_tree_node.adoc | 9 +++++---- docs/content/reference/input/parse_tree_input.adoc | 5 +++-- docs/layouts/reference/single.html | 9 +++++++-- docs/layouts/shortcodes/docref.adoc | 6 +++++- docs/layouts/shortcodes/experimental.html | 1 + include/lexy/_detail/config.hpp | 8 ++++++++ include/lexy/code_point.hpp | 4 ---- include/lexy/dsl.hpp | 5 ++++- include/lexy/dsl/parse_tree_node.hpp | 4 ++++ include/lexy/input/parse_tree_input.hpp | 4 ++++ include/lexy/parse_tree.hpp | 2 ++ src/CMakeLists.txt | 6 ++++++ tests/lexy/CMakeLists.txt | 2 +- tests/playground/CMakeLists.txt | 2 +- 20 files changed, 69 insertions(+), 22 deletions(-) create mode 100644 docs/layouts/shortcodes/experimental.html diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index f482edfba..3f6141492 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -12,7 +12,7 @@ === New Features -* Add `lexy::parse_tree_input` and `lexy::dsl::tnode`/`lexy::dsl::pnode` to support multi-pass parsing. +* **Experimental**: Add `lexy::parse_tree_input` and `lexy::dsl::tnode`/`lexy::dsl::pnode` to support multi-pass parsing. * Add `lexy::dsl::byte.if_`/`set`/`range`/`ascii` methods to match specific bytes. * Add an overload of `fatal_error()` on scanners that allows construction of type-erased generic errors (#134). * Add `lexy::buffer::release()` and `lexy::buffer::adopt()` to deconstruct a buffer into its components and re-assemble it later. diff --git a/docs/assets/css/style.scss b/docs/assets/css/style.scss index 955c86620..7e9d9fd26 100644 --- a/docs/assets/css/style.scss +++ b/docs/assets/css/style.scss @@ -59,12 +59,19 @@ h6 { a, a svg, button svg { color: $link-color; + fill: $link-color; + stroke: $link-color; transition: color ease 0.3s; } -a:hover, a svg:hover, button svg:hover { +a:hover, button:hover { color: $highlight-color; + svg { + color: $highlight-color; + fill: $highlight-color; + stroke: $highlight-color; + } } -a:focus, a svg:focus, button svg:focus { +a:focus, button:focus { outline: none; } diff --git a/docs/assets/examples/parse_tree_parsing.cpp b/docs/assets/examples/parse_tree_parsing.cpp index da49dc445..a249126b0 100644 --- a/docs/assets/examples/parse_tree_parsing.cpp +++ b/docs/assets/examples/parse_tree_parsing.cpp @@ -1,5 +1,6 @@ #include +#define LEXY_EXPERIMENTAL 1 #include #include #include diff --git a/docs/assets/icons/beta.svg b/docs/assets/icons/beta.svg index 187b57381..24bf8f20a 100644 --- a/docs/assets/icons/beta.svg +++ b/docs/assets/icons/beta.svg @@ -1 +1,3 @@ - \ No newline at end of file + +Experimental + diff --git a/docs/content/learn/build.adoc b/docs/content/learn/build.adoc index bfe7eec81..d74ce8322 100644 --- a/docs/content/learn/build.adoc +++ b/docs/content/learn/build.adoc @@ -28,8 +28,10 @@ It exposes the following targets: Link to this library if you want to use advanced Unicode rules that require the Unicode character database. `foonathan::lexy::ext` (header-only):: Link to this library if you want to use the extension headers in `lexy_ext/`. +`foonathan::lexy::experimental` (header-only):: + Link to this library if you want to use experimental features. `foonathan::lexy` (library):: - Umbrella target that links to all other targets. + Umbrella target that links to all targets except for `foonathan::lexy::experimental`. A minimal `CMakeLists.txt` that uses lexy can look like this: diff --git a/docs/content/learn/versioning.adoc b/docs/content/learn/versioning.adoc index 7e1b9d2a9..b261fa9ec 100644 --- a/docs/content/learn/versioning.adoc +++ b/docs/content/learn/versioning.adoc @@ -26,7 +26,7 @@ We promise: We reserve the right to: * Deprecate existing functionality and remove previously deprecated functionality. -* Change anything that is not documented. +* Change anything that is not documented or explicitly marked as experimental (enabled by linking `foonathan::lexy::experimental`). In particular, writing custom rules, readers, or parse actions is not guaranteed to work across major releases. * Change everything about the extension headers. * Change the behavior of rules on invalid input. diff --git a/docs/content/reference/dsl/parse_tree_node.adoc b/docs/content/reference/dsl/parse_tree_node.adoc index 240b99993..140c7fb8c 100644 --- a/docs/content/reference/dsl/parse_tree_node.adoc +++ b/docs/content/reference/dsl/parse_tree_node.adoc @@ -1,5 +1,6 @@ --- header: "lexy/dsl/parse_tree_node.hpp" +experimental: true entities: "lexy::dsl::tnode": tnode "lexy::dsl::pnode": pnode @@ -12,7 +13,7 @@ Rules for parsing a {{% docref "lexy::parse_tree_input" %}}. {{% godbolt-example "parse_tree_parsing" "Re-parse a parse tree" %}} [#tnode] -== Rule DSL `lexy::dsl::tnode` +== Rule DSL `lexy::dsl::tnode` {{< experimental >}} {{% interface %}} ---- @@ -56,7 +57,7 @@ Errors:: Parse tree:: A single token node that contains the node of the input parse tree with the same token kind. -=== Branch rule `lexy::dsl::tnode(lexeme_rule)`` +=== Branch rule `lexy::dsl::tnode(lexeme_rule)` {{% interface %}} ---- @@ -76,7 +77,7 @@ Errors:: NOTE: `lexeme_rule` matches characters, not other nodes. [#pnode] -== Rule DSL `lexy::dsl::pnode` +== Rule DSL `lexy::dsl::pnode` {{< experimental >}} {{% interface %}} ---- @@ -118,7 +119,7 @@ Matching:: Errors:: {{% docref "lexy::expected_char_class" %}} with the name of the production, at the starting reader position. -=== Branch rule `lexy::dsl::pnode(child_rule)`` +=== Branch rule `lexy::dsl::pnode(child_rule)` {{% interface %}} ---- diff --git a/docs/content/reference/input/parse_tree_input.adoc b/docs/content/reference/input/parse_tree_input.adoc index 044f39ec0..8f35d4489 100644 --- a/docs/content/reference/input/parse_tree_input.adoc +++ b/docs/content/reference/input/parse_tree_input.adoc @@ -1,5 +1,6 @@ --- header: "lexy/input/parse_tree_input.hpp" +experimental: true entities: "lexy::parse_tree_encoding": parse_tree_encoding "lexy::parse_tree_input": parse_tree_input @@ -13,7 +14,7 @@ entities: Inputs that read a {{% docref "lexy::parse_tree" %}}. [#parse_tree_encoding] -== Encoding `lexy::parse_tree_encoding` +== Encoding `lexy::parse_tree_encoding` {{< experimental >}} {{% interface %}} ---- @@ -29,7 +30,7 @@ The {{% encoding %}} of a {{% docref "lexy::parse_tree_input" %}}. It is a node encoding of the specified `Node` type, which must be a `lexy::parse_tree::node`. [#parse_tree_input] -== Input `lexy::parse_tree_input` +== Input `lexy::parse_tree_input` {{< experimental >}} {{% interface %}} ---- diff --git a/docs/layouts/reference/single.html b/docs/layouts/reference/single.html index 635630611..23715417b 100644 --- a/docs/layouts/reference/single.html +++ b/docs/layouts/reference/single.html @@ -18,11 +18,16 @@
+

{{ if (isset .Params "header") }} -

Header {{ .Params.header }}

+ Header {{ .Params.header }} {{ else }} -

{{ .Page.Title }}

+ {{ .Page.Title }} {{ end }} + {{ if (index .Params "experimental" | default false) }} + {{ (resources.Get "icons/beta.svg").Content | safeHTML }} + {{ end }} +