Skip to content

Commit

Permalink
Revert "feat(extras): Add stored attributes"
Browse files Browse the repository at this point in the history
This reverts commit 1050ad0.
  • Loading branch information
pdubroy committed Feb 25, 2024
1 parent 59b17ec commit cb455c0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
16 changes: 1 addition & 15 deletions packages/ohm-js/extras/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {BaseActionDict, Grammar, MatchResult, Node, Semantics} from 'ohm-js';
import {MatchResult, Grammar, Semantics} from 'ohm-js';

interface LineAndColumnInfo {
offset: number;
Expand Down Expand Up @@ -44,17 +44,3 @@ interface Example {
* `//- "shouldn't match"`. The examples text is a JSON string.
*/
export function extractExamples(grammarsDef: string): [Example];

export type StoredAttributeSetter<T> = (node: Node, val: T) => T;

/**
* Add a stored attribute named `attrName` to `semantics`. A stored attribute
* is similar to a normal attribute, but instead of being lazily computed, the
* value for each node is initialized by an initialization operation.
*/
export function addStoredAttribute<T>(
semantics: Semantics,
attrName: string,
initSignature: string,
actionProducer: (setter: StoredAttributeSetter<T>) => BaseActionDict<void>
): Semantics;
1 change: 0 additions & 1 deletion packages/ohm-js/extras/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ export {getLineAndColumnMessage, getLineAndColumn} from '../src/util.js';
export {VisitorFamily} from './VisitorFamily.js';
export {semanticsForToAST, toAST} from './semantics-toAST.js';
export {extractExamples} from './extractExamples.js';
export {addStoredAttribute} from './storedAttributes.js';

0 comments on commit cb455c0

Please sign in to comment.