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

good-enough-parser

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

good-enough-parser - npm Package Compare versions

Comparing version 1.1.12 to 1.1.13

6

dist/cjs/query/builder.d.ts
import type { TreeType } from '../parser/types';
import { AltMatcher, ManyMatcher, OpMatcher, SeqMatcher, SymMatcher } from './matchers';
import { AnchorMatcher } from './matchers/anchor-matcher';
import { BeginMatcher } from './matchers/anchor-matcher';
import { CommentMatcher } from './matchers/comment-matcher';

@@ -46,5 +46,6 @@ import { NumMatcher } from './matchers/num-matcher';

end(): EndBuilder<Ctx>;
join(other: QueryBuilder<Ctx>): SeqBuilder<Ctx>;
}
declare class BeginBuilder<Ctx> extends AbstractBuilder<Ctx> {
build(): AnchorMatcher<Ctx>;
build(): BeginMatcher<Ctx>;
}

@@ -62,2 +63,3 @@ declare class EndBuilder<Ctx> extends TerminalBuilder<Ctx> {

}
export declare function join<Ctx>(first: QueryBuilder<Ctx>, second: QueryBuilder<Ctx>, ...others: QueryBuilder<Ctx>[]): SeqBuilder<Ctx>;
declare class SymBuilder<Ctx> extends AbstractBuilder<Ctx> {

@@ -64,0 +66,0 @@ private opts;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildRoot = exports.str = exports.tree = exports.alt = exports.opt = exports.many = exports.num = exports.comment = exports.op = exports.sym = exports.begin = void 0;
exports.buildRoot = exports.str = exports.tree = exports.alt = exports.opt = exports.many = exports.num = exports.comment = exports.op = exports.sym = exports.join = exports.begin = void 0;
const matchers_1 = require("./matchers");

@@ -62,2 +62,6 @@ const anchor_matcher_1 = require("./matchers/anchor-matcher");

}
join(other) {
const builder = new SeqBuilder(this, other);
return builder;
}
}

@@ -67,3 +71,3 @@ // Anchors

build() {
return new anchor_matcher_1.AnchorMatcher();
return new anchor_matcher_1.BeginMatcher();
}

@@ -79,3 +83,3 @@ }

const matchers = matcher instanceof matchers_1.SeqMatcher ? matcher.seq : [matcher];
matchers.push(new anchor_matcher_1.AnchorMatcher());
matchers.push(new anchor_matcher_1.EndMatcher());
return new matchers_1.SeqMatcher({ matchers });

@@ -95,3 +99,6 @@ }

: [prev];
this.builders = [...prevSeq, next];
const nextSeq = next instanceof SeqBuilder
? next.builders
: [next];
this.builders = [...prevSeq, ...nextSeq];
}

@@ -103,2 +110,12 @@ build() {

}
function join(first, second, ...others) {
const seq = new SeqBuilder(first, second);
if (!others.length) {
return seq;
}
return others.reduce((res, query) => {
return res.join(query);
}, seq);
}
exports.join = join;
// Symbols

@@ -105,0 +122,0 @@ class SymBuilder extends AbstractBuilder {

import type { Checkpoint } from '../types';
import { AbstractMatcher } from './abstract-matcher';
export declare class AnchorMatcher<Ctx> extends AbstractMatcher<Ctx> {
export declare class BeginMatcher<Ctx> extends AbstractMatcher<Ctx> {
match(checkpoint: Checkpoint<Ctx>): Checkpoint<Ctx> | null;
}
export declare class EndMatcher<Ctx> extends AbstractMatcher<Ctx> {
match(checkpoint: Checkpoint<Ctx>): Checkpoint<Ctx> | null;
}
//# sourceMappingURL=anchor-matcher.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AnchorMatcher = void 0;
exports.EndMatcher = exports.BeginMatcher = void 0;
const abstract_matcher_1 = require("./abstract-matcher");
class AnchorMatcher extends abstract_matcher_1.AbstractMatcher {
class BeginMatcher extends abstract_matcher_1.AbstractMatcher {
match(checkpoint) {
var _a;
let { cursor } = checkpoint;
const { node } = cursor;
if ((node === null || node === void 0 ? void 0 : node.type) === '_start') {
if (((_a = cursor.node) === null || _a === void 0 ? void 0 : _a.type) === '_start') {
cursor = this.moveRight(cursor);
return { ...checkpoint, cursor };
}
if ((node === null || node === void 0 ? void 0 : node.type) === '_end') {
return null;
}
}
exports.BeginMatcher = BeginMatcher;
class EndMatcher extends abstract_matcher_1.AbstractMatcher {
match(checkpoint) {
var _a;
let { cursor } = checkpoint;
cursor = this.seekNext(cursor);
if (((_a = cursor.node) === null || _a === void 0 ? void 0 : _a.type) === '_end') {
return checkpoint;

@@ -19,3 +28,3 @@ }

}
exports.AnchorMatcher = AnchorMatcher;
exports.EndMatcher = EndMatcher;
//# sourceMappingURL=anchor-matcher.js.map

@@ -41,4 +41,5 @@ "use strict";

}
let upperCursor = this.walkDepth > 1 ? cursor.up : undefined;
while (upperCursor && this.walkDepth > 0) {
const canMoveUp = this.walkDepth > 1;
let upperCursor = canMoveUp ? cursor.up : undefined;
while (upperCursor && canMoveUp) {
rightCursor = upperCursor.right;

@@ -45,0 +46,0 @@ if (rightCursor) {

import type { TreeType } from '../parser/types';
import { AltMatcher, ManyMatcher, OpMatcher, SeqMatcher, SymMatcher } from './matchers';
import { AnchorMatcher } from './matchers/anchor-matcher';
import { BeginMatcher } from './matchers/anchor-matcher';
import { CommentMatcher } from './matchers/comment-matcher';

@@ -46,5 +46,6 @@ import { NumMatcher } from './matchers/num-matcher';

end(): EndBuilder<Ctx>;
join(other: QueryBuilder<Ctx>): SeqBuilder<Ctx>;
}
declare class BeginBuilder<Ctx> extends AbstractBuilder<Ctx> {
build(): AnchorMatcher<Ctx>;
build(): BeginMatcher<Ctx>;
}

@@ -62,2 +63,3 @@ declare class EndBuilder<Ctx> extends TerminalBuilder<Ctx> {

}
export declare function join<Ctx>(first: QueryBuilder<Ctx>, second: QueryBuilder<Ctx>, ...others: QueryBuilder<Ctx>[]): SeqBuilder<Ctx>;
declare class SymBuilder<Ctx> extends AbstractBuilder<Ctx> {

@@ -64,0 +66,0 @@ private opts;

import { AltMatcher, ManyMatcher, OpMatcher, SeqMatcher, SymMatcher, } from './matchers';
import { AnchorMatcher } from './matchers/anchor-matcher';
import { BeginMatcher, EndMatcher } from './matchers/anchor-matcher';
import { CommentMatcher } from './matchers/comment-matcher';

@@ -59,2 +59,6 @@ import { NumMatcher } from './matchers/num-matcher';

}
join(other) {
const builder = new SeqBuilder(this, other);
return builder;
}
}

@@ -64,3 +68,3 @@ // Anchors

build() {
return new AnchorMatcher();
return new BeginMatcher();
}

@@ -76,3 +80,3 @@ }

const matchers = matcher instanceof SeqMatcher ? matcher.seq : [matcher];
matchers.push(new AnchorMatcher());
matchers.push(new EndMatcher());
return new SeqMatcher({ matchers });

@@ -91,3 +95,6 @@ }

: [prev];
this.builders = [...prevSeq, next];
const nextSeq = next instanceof SeqBuilder
? next.builders
: [next];
this.builders = [...prevSeq, ...nextSeq];
}

@@ -99,2 +106,11 @@ build() {

}
export function join(first, second, ...others) {
const seq = new SeqBuilder(first, second);
if (!others.length) {
return seq;
}
return others.reduce((res, query) => {
return res.join(query);
}, seq);
}
// Symbols

@@ -101,0 +117,0 @@ class SymBuilder extends AbstractBuilder {

import type { Checkpoint } from '../types';
import { AbstractMatcher } from './abstract-matcher';
export declare class AnchorMatcher<Ctx> extends AbstractMatcher<Ctx> {
export declare class BeginMatcher<Ctx> extends AbstractMatcher<Ctx> {
match(checkpoint: Checkpoint<Ctx>): Checkpoint<Ctx> | null;
}
export declare class EndMatcher<Ctx> extends AbstractMatcher<Ctx> {
match(checkpoint: Checkpoint<Ctx>): Checkpoint<Ctx> | null;
}
//# sourceMappingURL=anchor-matcher.d.ts.map
import { AbstractMatcher } from './abstract-matcher';
export class AnchorMatcher extends AbstractMatcher {
export class BeginMatcher extends AbstractMatcher {
match(checkpoint) {
var _a;
let { cursor } = checkpoint;
const { node } = cursor;
if ((node === null || node === void 0 ? void 0 : node.type) === '_start') {
if (((_a = cursor.node) === null || _a === void 0 ? void 0 : _a.type) === '_start') {
cursor = this.moveRight(cursor);
return { ...checkpoint, cursor };
}
if ((node === null || node === void 0 ? void 0 : node.type) === '_end') {
return null;
}
}
export class EndMatcher extends AbstractMatcher {
match(checkpoint) {
var _a;
let { cursor } = checkpoint;
cursor = this.seekNext(cursor);
if (((_a = cursor.node) === null || _a === void 0 ? void 0 : _a.type) === '_end') {
return checkpoint;

@@ -12,0 +20,0 @@ }

@@ -38,4 +38,5 @@ import { isTree } from '../../parser';

}
let upperCursor = this.walkDepth > 1 ? cursor.up : undefined;
while (upperCursor && this.walkDepth > 0) {
const canMoveUp = this.walkDepth > 1;
let upperCursor = canMoveUp ? cursor.up : undefined;
while (upperCursor && canMoveUp) {
rightCursor = upperCursor.right;

@@ -42,0 +43,0 @@ if (rightCursor) {

{
"name": "good-enough-parser",
"description": "Parse and query computer programs source code",
"version": "1.1.12",
"version": "1.1.13",
"repository": "git@github.com:zharinov/good-enough-parser.git",

@@ -6,0 +6,0 @@ "author": "Sergei Zharinov",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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