lezer-tree
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -0,1 +1,11 @@ | ||
## 0.5.0 (2019-10-22) | ||
### New features | ||
Adds `NodeProp.top`, which flags a grammar's outer node type. | ||
### Breaking changes | ||
Drops the `NodeProp.lang` prop (superseded by `top`). | ||
## 0.4.0 (2019-09-10) | ||
@@ -2,0 +12,0 @@ |
@@ -41,3 +41,3 @@ export declare const DefaultBufferLength = 1024; | ||
static delim: NodeProp<string>; | ||
static lang: NodeProp<string>; | ||
static top: NodeProp<boolean>; | ||
static repeated: NodeProp<boolean>; | ||
@@ -44,0 +44,0 @@ } |
@@ -86,6 +86,4 @@ "use strict"; | ||
NodeProp.delim = NodeProp.string(); | ||
/// The top node for a grammar usually has a `lang` prop set to a | ||
/// string identifying the grammar, to provide context for the nodes | ||
/// inside of it. | ||
NodeProp.lang = NodeProp.string(); | ||
/// Indicates that this node indicates a top level document. | ||
NodeProp.top = NodeProp.flag(); | ||
/// A prop that indicates whether a node represents a repeated | ||
@@ -166,3 +164,5 @@ /// expression. Abstractions like [`Subtree`](#tree.Subtree) hide | ||
/// type should correspond to its position within the array. | ||
function NodeGroup(types) { | ||
function NodeGroup( | ||
/// The node types in this group, by id. | ||
types) { | ||
this.types = types; | ||
@@ -169,0 +169,0 @@ for (var i = 0; i < types.length; i++) |
{ | ||
"name": "lezer-tree", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Syntax tree data structure for the lezer parser", | ||
@@ -5,0 +5,0 @@ "main": "dist/tree.js", |
@@ -9,6 +9,2 @@ ### Trees | ||
@EnterFunc | ||
@LeaveFunc | ||
### Node types | ||
@@ -15,0 +11,0 @@ |
@@ -20,3 +20,3 @@ /// The default maximum length of a `TreeBuffer` node. | ||
/// passed to `Subtree.iterate`. | ||
/// Passed to `Subtree.iterate`. | ||
type IterateArgs<T> = { | ||
@@ -126,6 +126,4 @@ /// The function called when entering a node. It is given a node's | ||
/// The top node for a grammar usually has a `lang` prop set to a | ||
/// string identifying the grammar, to provide context for the nodes | ||
/// inside of it. | ||
static lang = NodeProp.string() | ||
/// Indicates that this node indicates a top level document. | ||
static top = NodeProp.flag() | ||
@@ -197,3 +195,6 @@ /// A prop that indicates whether a node represents a repeated | ||
/// type should correspond to its position within the array. | ||
constructor(readonly types: readonly NodeType[]) { | ||
constructor( | ||
/// The node types in this group, by id. | ||
readonly types: readonly NodeType[] | ||
) { | ||
for (let i = 0; i < types.length; i++) if (types[i].id != i) | ||
@@ -746,4 +747,4 @@ throw new RangeError("Node type ids should correspond to array positions when creating a node group") | ||
// This is used by `Tree.build` as an abstraction for iterating over | ||
// a tree buffer. | ||
/// This is used by `Tree.build` as an abstraction for iterating over | ||
/// a tree buffer. | ||
export interface BufferCursor { | ||
@@ -750,0 +751,0 @@ pos: number |
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
117208
1931