Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lezer

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lezer - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

.rpt2_cache/rpt2_7701c6e64bb6c56ec842cf648d1ad8f417be9894/code/cache/79e370cd6302ba93806e7ece8013bad5bfb8c7f9

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 0.8.1 (2020-02-26)
### New features
You can now find the top node type parsed by the parser through its `topType` property.
## 0.8.0 (2020-02-03)

@@ -2,0 +8,0 @@

16

dist/index.js

@@ -779,3 +779,3 @@ 'use strict';

this.tokenCount = 0;
var topInfo = parser.topRules[top || Object.keys(parser.topRules)[0]];
var topInfo = top ? parser.topRules[top] : parser.defaultTop;
if (!topInfo)

@@ -925,3 +925,3 @@ throw new RangeError("Invalid top rule name " + top);

else {
var topInfo = nested.topRules[top || Object.keys(nested.topRules)[0]];
var topInfo = top ? nested.topRules[top] : nested.defaultTop;
var newStack = Stack.start(new StackContext(nested, stack.cx.maxBufferLength, clippedInput, topInfo[1], stack, wrapType), topInfo[0], stack.pos);

@@ -1240,2 +1240,14 @@ if (verbose)

});
Object.defineProperty(Parser.prototype, "defaultTop", {
/// @internal
get: function () { return this.topRules[Object.keys(this.topRules)[0]]; },
enumerable: true,
configurable: true
});
Object.defineProperty(Parser.prototype, "topType", {
/// The node type produced by the default top rule.
get: function () { return this.group.types[this.defaultTop[1]]; },
enumerable: true,
configurable: true
});
/// (Used by the output of the parser generator) @internal

@@ -1242,0 +1254,0 @@ Parser.deserialize = function (spec) {

4

dist/parse.d.ts
import { Stack } from "./stack";
import { InputStream, Token, Tokenizer, TokenGroup } from "./token";
import { Tree, TreeBuffer, NodeGroup, NodeProp, NodePropSource } from "lezer-tree";
import { Tree, TreeBuffer, NodeGroup, NodeType, NodeProp, NodePropSource } from "lezer-tree";
export declare type NestedGrammar = null | Parser | ((input: InputStream, stack: Stack) => NestedGrammarSpec);

@@ -118,2 +118,4 @@ export interface NestedGrammarSpec {

get hasNested(): boolean;
get defaultTop(): [number, number];
get topType(): NodeType;
static deserialize(spec: {

@@ -120,0 +122,0 @@ states: string;

{
"name": "lezer",
"version": "0.8.0",
"version": "0.8.1",
"description": "Incremental parser",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -239,3 +239,3 @@ import {Stack, Recover} from "./stack"

{cache = undefined, strict = false, bufferLength = DefaultBufferLength, top = undefined}: ParseOptions = {}) {
let topInfo = parser.topRules[top || Object.keys(parser.topRules)[0]]
let topInfo = top ? parser.topRules[top] : parser.defaultTop
if (!topInfo) throw new RangeError(`Invalid top rule name ${top}`)

@@ -370,3 +370,3 @@ this.stacks = [Stack.start(new StackContext(parser, bufferLength, input, topInfo[1]), topInfo[0])]

} else {
let topInfo = nested.topRules[top || Object.keys(nested.topRules)[0]]
let topInfo = top ? nested.topRules[top] : nested.defaultTop
let newStack = Stack.start(new StackContext(nested, stack.cx.maxBufferLength, clippedInput, topInfo[1], stack, wrapType),

@@ -673,2 +673,8 @@ topInfo[0], stack.pos)

/// @internal
get defaultTop() { return this.topRules[Object.keys(this.topRules)[0]] }
/// The node type produced by the default top rule.
get topType() { return this.group.types[this.defaultTop[1]] }
/// (Used by the output of the parser generator) @internal

@@ -675,0 +681,0 @@ static deserialize(spec: {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc