lezer-tree
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -0,1 +1,7 @@ | ||
## 0.5.1 (2019-10-22) | ||
### New features | ||
`NodeProp.add` now also allows a selector object to be passed. | ||
## 0.5.0 (2019-10-22) | ||
@@ -2,0 +8,0 @@ |
@@ -37,3 +37,5 @@ export declare const DefaultBufferLength = 1024; | ||
}; | ||
add(f: (type: NodeType) => T | undefined): NodePropSource; | ||
add(match: { | ||
[selector: string]: T; | ||
} | ((type: NodeType) => T | undefined)): NodePropSource; | ||
static error: NodeProp<boolean>; | ||
@@ -40,0 +42,0 @@ static skipped: NodeProp<boolean>; |
@@ -69,6 +69,9 @@ "use strict"; | ||
/// [`Parser.withProps`](#lezer.Parser.withProps) to compute prop | ||
/// values for each node type in the group. Takes a function that | ||
/// returns undefined if the node type doesn't get this prop, or the | ||
/// prop's value if it does. | ||
NodeProp.prototype.add = function (f) { return new NodePropSource(this, f); }; | ||
/// values for each node type in the group. Takes a [match | ||
/// object](#tree.NodeType.match) or function that returns undefined | ||
/// if the node type doesn't get this prop, and the prop's value if | ||
/// it does. | ||
NodeProp.prototype.add = function (match) { | ||
return new NodePropSource(this, typeof match == "function" ? match : NodeType.match(match)); | ||
}; | ||
/// The special node type that the parser uses to represent parse | ||
@@ -75,0 +78,0 @@ /// errors has this flag set. (You shouldn't use it for custom nodes |
{ | ||
"name": "lezer-tree", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Syntax tree data structure for the lezer parser", | ||
@@ -5,0 +5,0 @@ "main": "dist/tree.js", |
@@ -104,6 +104,9 @@ /// The default maximum length of a `TreeBuffer` node. | ||
/// [`Parser.withProps`](#lezer.Parser.withProps) to compute prop | ||
/// values for each node type in the group. Takes a function that | ||
/// returns undefined if the node type doesn't get this prop, or the | ||
/// prop's value if it does. | ||
add(f: (type: NodeType) => T | undefined): NodePropSource { return new NodePropSource(this, f) } | ||
/// values for each node type in the group. Takes a [match | ||
/// object](#tree.NodeType.match) or function that returns undefined | ||
/// if the node type doesn't get this prop, and the prop's value if | ||
/// it does. | ||
add(match: {[selector: string]: T} | ((type: NodeType) => T | undefined)): NodePropSource { | ||
return new NodePropSource(this, typeof match == "function" ? match : NodeType.match(match)) | ||
} | ||
@@ -110,0 +113,0 @@ /// The special node type that the parser uses to represent parse |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
117714
1939