Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// --------------------------------------------------------------
// Tasksmith
// --------------------------------------------------------------
"tasksmith": "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.8.5/src/index.ts",
"tasksmith": "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/index.ts",
"test": "./test/common/index.ts",
// --------------------------------------------------------------
// ParseBox
Expand Down
234 changes: 71 additions & 163 deletions deno.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions example/ebnf/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ THE SOFTWARE.

---------------------------------------------------------------------------*/

import { Static } from '@sinclair/parsebox'
import { type Static } from '@sinclair/parsebox'
import { Module } from './runtime.ts'
import { Ebnf } from './static.ts'
import { type Ebnf } from './static.ts'

/** Parses a Ebnf module */
export function ParseEbnf<S extends string>(value: S): Static.Parse<Ebnf, S>[0] {
Expand Down
4 changes: 2 additions & 2 deletions example/json/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ THE SOFTWARE.

---------------------------------------------------------------------------*/

import { Static } from '@sinclair/parsebox'
import { type Static } from '@sinclair/parsebox'
import { type Json } from './static.ts'
import { JsonModule } from './runtime.ts'
import { Json } from './static.ts'

/** Parses a Json string */
export function ParseJson<S extends string>(value: S): Static.Parse<Json, S>[0] {
Expand Down
2 changes: 1 addition & 1 deletion example/uri/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ THE SOFTWARE.
// deno-fmt-ignore-file

import { Static } from '@sinclair/parsebox'
import { TExpression, TSimple, TParam, TQuery, TFragment, TReserved, TLiteral, TLabel, TPath, TMatrix, TContinuation } from './types.ts'
import type { TExpression, TSimple, TParam, TQuery, TFragment, TReserved, TLiteral, TLabel, TPath, TMatrix, TContinuation } from './types.ts'

// -------------------------------------------------------------------
// URI Template Parser (Type Level)
Expand Down
3 changes: 2 additions & 1 deletion src/build/common/escape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ THE SOFTWARE.
// deno-fmt-ignore-file

export function Escape(input: string): string {
return input.replace(/\n/g, "\\n")
return input.replace(/\\/g, '\\\\')
.replace(/\n/g, "\\n")
.replace(/\r/g, "\\r")
.replace(/"/g, '\\"')
.replace(/'/g, "\\'");
Expand Down
3 changes: 2 additions & 1 deletion src/build/common/infer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ THE SOFTWARE.

import { Unreachable } from '../../system/unreachable/index.ts'
import * as Runtime from '../../runtime/index.ts'
import { Escape } from './escape.ts'

function InferArray(parser: Runtime.IParser): string {
return `(${Infer(parser)})[]`
}
function InferConst(parser: Runtime.IConst) {
return `'${parser.const}'`
return `'${Escape(parser.const)}'`
}
function InferBigInt(parser: Runtime.IBigInt) {
return `string`
Expand Down
2 changes: 1 addition & 1 deletion tasks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Task } from 'tasksmith'

const VERSION = '0.11.4'
const VERSION = '0.11.5'

// ------------------------------------------------------------------
// Clean
Expand Down
Loading