@getlang/parser
Advanced tools
Comparing version 0.0.25 to 0.1.0
import type { Doc } from 'prettier' | ||
import { doc } from 'prettier' | ||
import type { InterpretVisitor } from '../visitor/visitor.js' | ||
import { visit } from '../visitor/visitor.js' | ||
import type { Node } from './ast.js' | ||
import { NodeKind } from './ast.js' | ||
import type { InterpretVisitor } from '../visitor/visitor.js' | ||
import { visit } from '../visitor/visitor.js' | ||
@@ -8,0 +8,0 @@ // NOTE: avoid using template interpolation with prettier.Doc |
@@ -1,2 +0,2 @@ | ||
import { invariant, ValueReferenceError } from '@getlang/utils' | ||
import { ValueReferenceError, invariant } from '@getlang/utils' | ||
@@ -3,0 +3,0 @@ export class Scope<T> { |
import { | ||
invariant, | ||
QuerySyntaxError, | ||
ValueReferenceError, | ||
invariant, | ||
} from '@getlang/utils' | ||
@@ -10,4 +10,4 @@ import type { Expr, RequestExpr, Stmt } from '../../ast/ast.js' | ||
import type { TransformVisitor } from '../../visitor/transform.js' | ||
import { traceVisitor } from '../trace.js' | ||
import { createToken, render, template } from '../utils.js' | ||
import { traceVisitor } from '../trace.js' | ||
@@ -14,0 +14,0 @@ type Urls = Map<RequestExpr, [index: number]> |
@@ -1,2 +0,2 @@ | ||
import { invariant, QuerySyntaxError } from '@getlang/utils' | ||
import { QuerySyntaxError, invariant } from '@getlang/utils' | ||
import type { CExpr, Expr, RequestExpr, Stmt } from '../../ast/ast.js' | ||
@@ -6,4 +6,4 @@ import { NodeKind, t } from '../../ast/ast.js' | ||
import type { TransformVisitor } from '../../visitor/transform.js' | ||
import { traceVisitor } from '../trace.js' | ||
import { createToken, getContentMod, template } from '../utils.js' | ||
import { traceVisitor } from '../trace.js' | ||
@@ -10,0 +10,0 @@ type Parsers = Map<RequestExpr, [mods: Set<string>, index: number]> |
@@ -6,4 +6,4 @@ /// <reference types="./acorn-globals.d.ts" /> | ||
import globals from 'globals' | ||
import { t } from '../../ast/ast.js' | ||
import type { TransformVisitor } from '../../visitor/transform.js' | ||
import { t } from '../../ast/ast.js' | ||
import { createToken } from '../utils.js' | ||
@@ -10,0 +10,0 @@ |
import { | ||
invariant, | ||
QuerySyntaxError, | ||
ValueReferenceError, | ||
invariant, | ||
} from '@getlang/utils' | ||
import { NodeKind, type CExpr, type Expr, t } from '../../ast/ast.js' | ||
import { type CExpr, type Expr, NodeKind, t } from '../../ast/ast.js' | ||
import { RootScope } from '../../ast/scope.js' | ||
import { Type, type TypeInfo } from '../../ast/typeinfo.js' | ||
import type { TransformVisitor, Visit } from '../../visitor/transform.js' | ||
import { traceVisitor } from '../trace.js' | ||
import { Type, type TypeInfo } from '../../ast/typeinfo.js' | ||
import { render, selectTypeInfo } from '../utils.js' | ||
@@ -12,0 +12,0 @@ |
@@ -1,7 +0,7 @@ | ||
import { invariant, QuerySyntaxError } from '@getlang/utils' | ||
import { QuerySyntaxError, invariant } from '@getlang/utils' | ||
import type { Program } from '../ast/ast.js' | ||
import { NodeKind } from '../ast/ast.js' | ||
import { visit } from '../visitor/visitor.js' | ||
import { inferBase } from './inference/base.js' | ||
import { inferContext } from './inference/context.js' | ||
import { inferBase } from './inference/base.js' | ||
import { inferSliceDeps } from './inference/slicedeps.js' | ||
@@ -8,0 +8,0 @@ import { inferTypeInfo } from './inference/typeinfo.js' |
@@ -1,5 +0,5 @@ | ||
import type { Expr, CExpr } from '../ast/ast.js' | ||
import type { CExpr, Expr } from '../ast/ast.js' | ||
import { t } from '../ast/ast.js' | ||
import type { RootScope } from '../ast/scope.js' | ||
import type { Visit, TransformVisitor } from '../visitor/transform.js' | ||
import type { TransformVisitor, Visit } from '../visitor/transform.js' | ||
@@ -6,0 +6,0 @@ export function traceVisitor(scope: RootScope<Expr>) { |
import { toPath } from 'lodash-es' | ||
import type { Expr, RequestExpr } from '../ast/ast.js' | ||
import { NodeKind, t } from '../ast/ast.js' | ||
import type { TypeInfo, Struct } from '../ast/typeinfo.js' | ||
import type { Struct, TypeInfo } from '../ast/typeinfo.js' | ||
import { Type } from '../ast/typeinfo.js' | ||
@@ -6,0 +6,0 @@ |
import { doc } from 'prettier'; | ||
import { visit } from '../visitor/visitor.js'; | ||
import { NodeKind } from './ast.js'; | ||
import { visit } from '../visitor/visitor.js'; | ||
// NOTE: avoid using template interpolation with prettier.Doc | ||
@@ -5,0 +5,0 @@ // as the Doc may be a Doc array or Doc command |
@@ -1,2 +0,2 @@ | ||
import { invariant, ValueReferenceError } from '@getlang/utils'; | ||
import { ValueReferenceError, invariant } from '@getlang/utils'; | ||
export class Scope { | ||
@@ -3,0 +3,0 @@ vars; |
@@ -1,6 +0,6 @@ | ||
import { invariant, QuerySyntaxError, ValueReferenceError, } from '@getlang/utils'; | ||
import { QuerySyntaxError, ValueReferenceError, invariant, } from '@getlang/utils'; | ||
import { NodeKind, t } from '../../ast/ast.js'; | ||
import { RootScope } from '../../ast/scope.js'; | ||
import { traceVisitor } from '../trace.js'; | ||
import { createToken, render, template } from '../utils.js'; | ||
import { traceVisitor } from '../trace.js'; | ||
function insertUrls(stmts, urls) { | ||
@@ -7,0 +7,0 @@ return stmts.flatMap(stmt => { |
@@ -1,6 +0,6 @@ | ||
import { invariant, QuerySyntaxError } from '@getlang/utils'; | ||
import { QuerySyntaxError, invariant } from '@getlang/utils'; | ||
import { NodeKind, t } from '../../ast/ast.js'; | ||
import { RootScope } from '../../ast/scope.js'; | ||
import { traceVisitor } from '../trace.js'; | ||
import { createToken, getContentMod, template } from '../utils.js'; | ||
import { traceVisitor } from '../trace.js'; | ||
function insertParsers(stmts, parsers) { | ||
@@ -7,0 +7,0 @@ return stmts.flatMap(stmt => { |
@@ -1,6 +0,6 @@ | ||
import { invariant, QuerySyntaxError, ValueReferenceError, } from '@getlang/utils'; | ||
import { QuerySyntaxError, ValueReferenceError, invariant, } from '@getlang/utils'; | ||
import { NodeKind, t } from '../../ast/ast.js'; | ||
import { RootScope } from '../../ast/scope.js'; | ||
import { Type } from '../../ast/typeinfo.js'; | ||
import { traceVisitor } from '../trace.js'; | ||
import { Type } from '../../ast/typeinfo.js'; | ||
import { render, selectTypeInfo } from '../utils.js'; | ||
@@ -7,0 +7,0 @@ function clone(a) { |
@@ -1,6 +0,6 @@ | ||
import { invariant, QuerySyntaxError } from '@getlang/utils'; | ||
import { QuerySyntaxError, invariant } from '@getlang/utils'; | ||
import { NodeKind } from '../ast/ast.js'; | ||
import { visit } from '../visitor/visitor.js'; | ||
import { inferBase } from './inference/base.js'; | ||
import { inferContext } from './inference/context.js'; | ||
import { inferBase } from './inference/base.js'; | ||
import { inferSliceDeps } from './inference/slicedeps.js'; | ||
@@ -7,0 +7,0 @@ import { inferTypeInfo } from './inference/typeinfo.js'; |
import type { Expr, RequestExpr } from '../ast/ast.js'; | ||
import type { TypeInfo, Struct } from '../ast/typeinfo.js'; | ||
import type { Struct, TypeInfo } from '../ast/typeinfo.js'; | ||
export declare const render: (template: Expr) => string | null; | ||
@@ -4,0 +4,0 @@ export declare function selectTypeInfo(typeInfo: Struct, selector: Expr): TypeInfo | null; |
@@ -1,2 +0,2 @@ | ||
import { invariant, QuerySyntaxError } from '@getlang/utils'; | ||
import { QuerySyntaxError, invariant } from '@getlang/utils'; | ||
import { until } from './templates.js'; | ||
@@ -3,0 +3,0 @@ const getSliceValue = (text, places = 1) => { |
@@ -1,2 +0,2 @@ | ||
import { ws, identifier } from './shared.js'; | ||
import { identifier, ws } from './shared.js'; | ||
// creates a new regex that consumes characters until the | ||
@@ -3,0 +3,0 @@ // `term` regex has been reached. the regex is multiline |
@@ -1,4 +0,2 @@ | ||
import { identifier } from './lex/shared.js'; | ||
declare const lexer: any; | ||
export default lexer; | ||
export { identifier }; |
import moo from 'moo'; | ||
import { ws, identifier, identifierExpr, popAll } from './lex/shared.js'; | ||
import { templateUntil, interpExpr } from './lex/templates.js'; | ||
import { identifier, identifierExpr, popAll, ws } from './lex/shared.js'; | ||
import { slice, slice_block } from './lex/slice.js'; | ||
import { interpExpr, templateUntil } from './lex/templates.js'; | ||
const verbs = ['GET', 'PUT', 'POST', 'PATCH', 'DELETE']; | ||
@@ -124,3 +124,2 @@ const keywords = ['import', 'inputs', 'set']; | ||
export default lexer; | ||
export { identifier }; | ||
//# sourceMappingURL=lexer.js.map |
@@ -1,3 +0,3 @@ | ||
import { invariant, QuerySyntaxError } from '@getlang/utils'; | ||
import { t, NodeKind } from '../ast/ast.js'; | ||
import { QuerySyntaxError, invariant } from '@getlang/utils'; | ||
import { NodeKind, t } from '../ast/ast.js'; | ||
export const program = ([, maybeHeader, body]) => { | ||
@@ -4,0 +4,0 @@ const header = maybeHeader || []; |
import type { Program } from './ast/ast.js'; | ||
export { print } from './ast/print.js'; | ||
export { desugar } from './desugar/simplified.js'; | ||
export { print } from './ast/print.js'; | ||
export declare function parse(source: string): Program; |
@@ -0,7 +1,7 @@ | ||
import { QuerySyntaxError } from '@getlang/utils'; | ||
import nearley from 'nearley'; | ||
import { QuerySyntaxError } from '@getlang/utils'; | ||
import grammar from './grammar.js'; | ||
import lexer from './grammar/lexer.js'; | ||
export { print } from './ast/print.js'; | ||
export { desugar } from './desugar/simplified.js'; | ||
export { print } from './ast/print.js'; | ||
export function parse(source) { | ||
@@ -8,0 +8,0 @@ const parser = new nearley.Parser(nearley.Grammar.fromCompiled(grammar)); |
import type { MaybePromise } from '@getlang/utils'; | ||
import type { Node, Stmt, Expr } from '../ast/ast.js'; | ||
import type { Expr, Node, Stmt } from '../ast/ast.js'; | ||
type Transform<V, S, E> = V extends V ? V extends Stmt ? S : V extends Expr ? E : { | ||
@@ -4,0 +4,0 @@ [K in keyof V]: Transform<V[K], S, E>; |
@@ -1,2 +0,2 @@ | ||
import type { Node, Expr, Stmt } from '../ast/ast.js'; | ||
import type { Expr, Node, Stmt } from '../ast/ast.js'; | ||
import type { TypeInfo } from '../ast/typeinfo.js'; | ||
@@ -3,0 +3,0 @@ type FilterNarrow<T> = Expr extends T ? FilterNarrow<Exclude<T, Expr>> : T extends Stmt | TypeInfo ? never : T extends Expr ? T : T extends readonly (infer E)[] ? FilterNarrow<E> : T extends object ? Collect<T> : never; |
import type { Node } from '../ast/ast.js'; | ||
import type { AsyncInterpretVisitor, InterpretVisitor } from './interpret.js'; | ||
import type { TransformVisitor } from './transform.js'; | ||
import type { InterpretVisitor, AsyncInterpretVisitor } from './interpret.js'; | ||
export type { TransformVisitor, InterpretVisitor, AsyncInterpretVisitor }; | ||
type Visitor = TransformVisitor | InterpretVisitor<any, any> | AsyncInterpretVisitor<any, any>; | ||
export declare function visit<N extends Node, V extends Visitor>(node: N, visitor: V): any; |
@@ -1,2 +0,2 @@ | ||
import { invariant, QuerySyntaxError } from '@getlang/utils' | ||
import { QuerySyntaxError, invariant } from '@getlang/utils' | ||
import { until } from './templates.js' | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { ws, identifier } from './shared.js' | ||
import { identifier, ws } from './shared.js' | ||
@@ -3,0 +3,0 @@ type UntilOptions = { |
import moo from 'moo' | ||
import { ws, identifier, identifierExpr, popAll } from './lex/shared.js' | ||
import { templateUntil, interpExpr } from './lex/templates.js' | ||
import { identifier, identifierExpr, popAll, ws } from './lex/shared.js' | ||
import { slice, slice_block } from './lex/slice.js' | ||
import { interpExpr, templateUntil } from './lex/templates.js' | ||
@@ -131,2 +131,1 @@ const verbs = ['GET', 'PUT', 'POST', 'PATCH', 'DELETE'] | ||
export default lexer | ||
export { identifier } |
@@ -1,3 +0,3 @@ | ||
import { invariant, QuerySyntaxError } from '@getlang/utils' | ||
import { t, NodeKind } from '../ast/ast.js' | ||
import { QuerySyntaxError, invariant } from '@getlang/utils' | ||
import { NodeKind, t } from '../ast/ast.js' | ||
@@ -4,0 +4,0 @@ type PP = nearley.Postprocessor |
@@ -0,9 +1,9 @@ | ||
import { QuerySyntaxError } from '@getlang/utils' | ||
import nearley from 'nearley' | ||
import { QuerySyntaxError } from '@getlang/utils' | ||
import type { Program } from './ast/ast.js' | ||
import grammar from './grammar.js' | ||
import lexer from './grammar/lexer.js' | ||
import type { Program } from './ast/ast.js' | ||
export { print } from './ast/print.js' | ||
export { desugar } from './desugar/simplified.js' | ||
export { print } from './ast/print.js' | ||
@@ -10,0 +10,0 @@ export function parse(source: string): Program { |
{ | ||
"name": "@getlang/parser", | ||
"version": "0.0.25", | ||
"version": "0.1.0", | ||
"license": "Apache-2.0", | ||
@@ -42,12 +42,16 @@ "type": "module", | ||
"dependencies": { | ||
"@getlang/utils": "^0.0.15", | ||
"@getlang/utils": "^0.1.0", | ||
"@types/moo": "^0.5.9", | ||
"@types/nearley": "^2.11.5", | ||
"acorn": "^8.12.0", | ||
"acorn": "^8.12.1", | ||
"acorn-globals": "^7.0.1", | ||
"globals": "^15.6.0", | ||
"globals": "^15.9.0", | ||
"lodash-es": "^4.17.21", | ||
"moo": "^0.5.2", | ||
"nearley": "^2.20.1", | ||
"prettier": "^3.3.2" | ||
"prettier": "^3.3.3" | ||
}, | ||
"devDependencies": { | ||
"@types/lodash-es": "^4.17.12" | ||
} | ||
} |
import type { MaybePromise } from '@getlang/utils' | ||
import type { Node, Stmt, Expr } from '../ast/ast.js' | ||
import type { Expr, Node, Stmt } from '../ast/ast.js' | ||
@@ -4,0 +4,0 @@ type Transform<V, S, E> = V extends V |
@@ -1,2 +0,2 @@ | ||
import type { Node, Expr, Stmt } from '../ast/ast.js' | ||
import type { Expr, Node, Stmt } from '../ast/ast.js' | ||
import type { TypeInfo } from '../ast/typeinfo.js' | ||
@@ -3,0 +3,0 @@ |
import { wait, waitMap } from '@getlang/utils' | ||
import type { Node } from '../ast/ast.js' | ||
import { NodeKind } from '../ast/ast.js' | ||
import type { AsyncInterpretVisitor, InterpretVisitor } from './interpret.js' | ||
import type { TransformVisitor } from './transform.js' | ||
import type { InterpretVisitor, AsyncInterpretVisitor } from './interpret.js' | ||
@@ -7,0 +7,0 @@ export type { TransformVisitor, InterpretVisitor, AsyncInterpretVisitor } |
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
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
214372
88
10
1
3973
+ Addedlodash-es@^4.17.21
+ Added@getlang/utils@0.1.1(transitive)
+ Addedlodash-es@4.17.21(transitive)
- Removed@getlang/utils@0.0.15(transitive)
Updated@getlang/utils@^0.1.0
Updatedacorn@^8.12.1
Updatedglobals@^15.9.0
Updatedprettier@^3.3.3