Skip to content

Commit 482a51f

Browse files
committed
Escape Double Quoted Strings
1 parent 2e06a37 commit 482a51f

7 files changed

Lines changed: 81 additions & 171 deletions

File tree

deno.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// --------------------------------------------------------------
1414
// Tasksmith
1515
// --------------------------------------------------------------
16-
"tasksmith": "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.8.5/src/index.ts",
16+
"tasksmith": "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/index.ts",
1717
"test": "./test/common/index.ts",
1818
// --------------------------------------------------------------
1919
// ParseBox

deno.lock

Lines changed: 71 additions & 163 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/ebnf/parse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ THE SOFTWARE.
2626
2727
---------------------------------------------------------------------------*/
2828

29-
import { Static } from '@sinclair/parsebox'
29+
import { type Static } from '@sinclair/parsebox'
3030
import { Module } from './runtime.ts'
31-
import { Ebnf } from './static.ts'
31+
import { type Ebnf } from './static.ts'
3232

3333
/** Parses a Ebnf module */
3434
export function ParseEbnf<S extends string>(value: S): Static.Parse<Ebnf, S>[0] {

example/json/parse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ THE SOFTWARE.
2626
2727
---------------------------------------------------------------------------*/
2828

29-
import { Static } from '@sinclair/parsebox'
29+
import { type Static } from '@sinclair/parsebox'
30+
import { type Json } from './static.ts'
3031
import { JsonModule } from './runtime.ts'
31-
import { Json } from './static.ts'
3232

3333
/** Parses a Json string */
3434
export function ParseJson<S extends string>(value: S): Static.Parse<Json, S>[0] {

example/uri/parse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ THE SOFTWARE.
2929
// deno-fmt-ignore-file
3030

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

3434
// -------------------------------------------------------------------
3535
// URI Template Parser (Type Level)

src/build/common/escape.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ THE SOFTWARE.
2929
// deno-fmt-ignore-file
3030

3131
export function Escape(input: string): string {
32-
return input.replace(/\n/g, "\\n")
32+
return input.replace(/\\/g, '\\\\')
33+
.replace(/\n/g, "\\n")
3334
.replace(/\r/g, "\\r")
3435
.replace(/"/g, '\\"')
3536
.replace(/'/g, "\\'");

src/build/common/infer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ THE SOFTWARE.
3131

3232
import { Unreachable } from '../../system/unreachable/index.ts'
3333
import * as Runtime from '../../runtime/index.ts'
34+
import { Escape } from './escape.ts'
3435

3536
function InferArray(parser: Runtime.IParser): string {
3637
return `(${Infer(parser)})[]`
3738
}
3839
function InferConst(parser: Runtime.IConst) {
39-
return `'${parser.const}'`
40+
return `'${Escape(parser.const)}'`
4041
}
4142
function InferBigInt(parser: Runtime.IBigInt) {
4243
return `string`

0 commit comments

Comments
 (0)