From 3639e837887089969234bf84d0ecd2887a43930c Mon Sep 17 00:00:00 2001 From: Patrick Dubroy Date: Thu, 6 Jan 2022 07:41:59 +0100 Subject: [PATCH] doc: Add documentation for applySyntactic --- CHANGELOG.md | 4 +++- doc/syntax-reference.md | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01b9d35b..c7fcf5d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,9 @@ ## v16.1.0 - Jan 6, 2022 -- Add `applySyntactic`, a built-in rule to allow application of a syntactic rule from a lexical context (see #136 for details). +- Added [`applySyntactic`][], a built-in rule to allow application of a syntactic rule from a lexical context (see #136 for details). + +[applySyntactic]: ./doc/syntax-reference.md#applySyntactic ## v16.0.0 - Oct 1, 2021 diff --git a/doc/syntax-reference.md b/doc/syntax-reference.md index cd5850ff..47da94d7 100644 --- a/doc/syntax-reference.md +++ b/doc/syntax-reference.md @@ -165,6 +165,8 @@ as well as multiline (`/* */`) comments like: listOf<elem, sep>: Similar to `ListOf` but interpreted as [lexical rule](#syntactic-lexical). +applySyntactic<ruleName>: Allows the syntactic rule _ruleName_ to be applied in a lexical context, which is otherwise not allowed. Spaces are skipped _before_ and _after_ the rule application. _New in Ohm v16.1.0._ + ## Grammar Syntax ### Grammar Inheritance @@ -318,7 +320,7 @@ A few other details that are helpful to know: 1. If the start rule is a syntactic rule, both leading and trailing spaces are skipped around the top-level application. 2. When the body of a rule contains a [repetition operator](#repetition-operators---) (e.g. `+` or `*`), spaces are skipped before each match. In other words, `Names = name+` is equivalent to `names = (spaces name)+`. -3. The [lexification operator (`#`)](lexification-) can be used in the body of a syntactic rule to prevent space skipping in specific places. For example, to +3. The [lexification operator (`#`)](lexification-) can be used in the body of a syntactic rule to prevent space skipping in specific places. For example: