Skip to content

Commit

Permalink
chore: Replace git.io links with links to ohmjs.org
Browse files Browse the repository at this point in the history
  • Loading branch information
pdubroy committed May 2, 2022
1 parent 049b353 commit 211aed7
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions doc/releases/ohm-js-16.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

### Args to _\_iter_ and _\_nonterminal_ actions

<!-- https://git.io/Jz4CI -->
<!-- https://ohmjs.org/d/ati -->

The [`_iter` and `_nonterminal` actions](../api-reference.md#special-actions) now take a variable number of arguments, rather than a single `Node[]` argument containing the child nodes. To make existing code work with Ohm v16, you should change the parameter to a [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) — e.g., `_iter(children) { ... }` should be changed to `_iter(...children) { ... }`. You can easily find code that needs to change because `addOperation` and friends will now throw an exception if your actions have a single parameter which is _not_ a rest parameter. See [#324](https://github.com/harc/ohm/issues/324) for the reasons behind this change.

### Default semantic actions

<!-- https://git.io/JRwtG -->
<!-- https://ohmjs.org/d/dsa -->

In operations and attributes, if you haven't defined a semantic action for a particular rule application node, a default action will be used in some cases. For example, your grammar has an _AddExp_ rule but your action dictionary doesn't contain a semantic action named 'AddExp'. **In Ohm v16.0, there is no longer a default action for iteration nodes** — it is _only_ defined for non-terminal nodes with exactly one child. See [#309](https://github.com/harc/ohm/issues/309) for context on this change.

Expand All @@ -26,7 +26,7 @@ _iter(...children) {

### grammarFromScriptElement / grammarsFromScriptElements

<!-- https://git.io/Jwow5 -->
<!-- https://ohmjs.org/d/gfs -->

The functions `grammarFromScriptElement` and `grammarsFromScriptElements` have been removed. When using Ohm in the browser, it's now recommended to put your grammar in a [template literal with String.raw](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/raw):

Expand Down
2 changes: 1 addition & 1 deletion doc/syntax-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ AddExp_plus = AddExp "+" MulExp

<h3 id="syntactic-lexical">Syntactic vs. Lexical Rules</h3>

<!-- https://git.io/JiYgP -->
<!-- https://ohmjs.org/d/svl -->

A _syntactic rule_ is a rule whose name begins with an uppercase letter, and _lexical rule_ is one whose name begins with a lowercase letter. The difference between lexical and syntactic rules is that syntactic rules implicitly skip whitespace characters.

Expand Down
2 changes: 1 addition & 1 deletion examples/math/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
and the `String.raw` tag.
The template literal syntax enables multi-line strings, and String.raw makes it simpler to
use escape codes like "\n" in your grammars -- see https://git.io/J0gPJ for more details.
use escape codes like "\n" in your grammars -- see https://ohmjs.org/d/sc for more details.
*/
const source = String.raw`
// An Ohm grammar for arithmetic expressions.
Expand Down
4 changes: 2 additions & 2 deletions packages/ohm-js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ declare namespace ohm {

/**
* grammarFromScriptElement was removed in Ohm v16.0. See
* https://git.io/Jwow5 for more info.
* https://ohmjs.org/d/gfs for more info.
* @deprecated
*/
function grammarFromScriptElement(node?: unknown, namespace?: Namespace): Grammar;
Expand All @@ -28,7 +28,7 @@ declare namespace ohm {

/**
* grammarsFromScriptElements was removed in Ohm v16.0. See
* https://git.io/Jwow5 for more info.
* https://ohmjs.org/d/gfs for more info.
* @deprecated
*/
function grammarsFromScriptElements(nodeList?: unknown, namespace?: Namespace): Namespace;
Expand Down
4 changes: 2 additions & 2 deletions packages/ohm-js/scripts/data/index.d.ts.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ declare namespace ohm {

/**
* grammarFromScriptElement was removed in Ohm v16.0. See
* https://git.io/Jwow5 for more info.
* https://ohmjs.org/d/gfs for more info.
* @deprecated
*/
function grammarFromScriptElement(node?: unknown, namespace?: Namespace): Grammar;
Expand All @@ -27,7 +27,7 @@ declare namespace ohm {

/**
* grammarsFromScriptElements was removed in Ohm v16.0. See
* https://git.io/Jwow5 for more info.
* https://ohmjs.org/d/gfs for more info.
* @deprecated
*/
function grammarsFromScriptElements(nodeList?: unknown, namespace?: Namespace): Namespace;
Expand Down
2 changes: 1 addition & 1 deletion packages/ohm-js/src/Grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Grammar.prototype = {
if (k === '_iter' || k === '_nonterminal') {
details =
`it should use a rest parameter, e.g. \`${k}(...children) {}\`. ` +
'NOTE: this is new in Ohm v16 — see https://git.io/Jz4CI for details.';
'NOTE: this is new in Ohm v16 — see https://ohmjs.org/d/ati for details.';
} else {
details = `expected ${expected}, got ${actual}`;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ohm-js/src/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function invalidParameter(ruleName, expr) {

const syntacticVsLexicalNote =
'NOTE: A _syntactic rule_ is a rule whose name begins with a capital letter. ' +
'See https://git.io/JiYgP for more details.';
'See https://ohmjs.org/d/svl for more details.';

function applicationOfSyntacticRuleFromLexicalContext(ruleName, applyExpr) {
return createError(
Expand Down Expand Up @@ -298,7 +298,7 @@ function missingSemanticAction(ctorName, name, type, stack) {
if (ctorName === '_iter') {
moreInfo = [
'\nNOTE: as of Ohm v16, there is no default action for iteration nodes — see ',
' https://git.io/JRwtG for details.',
' https://ohmjs.org/d/dsa for details.',
].join('\n');
}

Expand Down
4 changes: 2 additions & 2 deletions packages/ohm-js/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,13 @@ function grammars(source, optNamespace) {

function grammarFromScriptElement(optNode) {
throw new Error(
'grammarFromScriptElement was removed in Ohm v16.0. See https://git.io/Jwow5 for more info.'
'grammarFromScriptElement was removed in Ohm v16.0. See https://ohmjs.org/d/gfs for more info.'
);
}

function grammarsFromScriptElements(optNodeOrNodeList) {
throw new Error(
'grammarsFromScriptElements was removed in Ohm v16.0. See https://git.io/Jwow5 for more info.'
'grammarsFromScriptElements was removed in Ohm v16.0. See https://ohmjs.org/d/gfs for more info.'
);
}

Expand Down

0 comments on commit 211aed7

Please sign in to comment.