Skip to content

Commit

Permalink
doc: Add documentation for applySyntactic
Browse files Browse the repository at this point in the history
  • Loading branch information
pdubroy committed Jan 6, 2022
1 parent 6f8898e commit 3639e83
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion doc/syntax-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ as well as multiline (`/* */`) comments like:

<code>listOf&lt;<i>elem</i>, <i>sep</i>&gt;</code>: Similar to `ListOf<elem, sep>` but interpreted as [lexical rule](#syntactic-lexical).

<code id="applySyntactic">applySyntactic&lt;<i>ruleName</i>&gt;</code>: 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
Expand Down Expand Up @@ -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:

<!-- @markscript
let syntacticKeyValueDef;
Expand Down

0 comments on commit 3639e83

Please sign in to comment.