Skip to content

Commit

Permalink
🎨 export non-dumping json parser
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAfroOfDoom committed May 14, 2024
1 parent 74a6855 commit 5bffcff
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/java-edition/src/mcfunction/parser/argument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ function block(isPredicate: boolean): core.InfallibleParser<BlockNode> {
const blockState: core.InfallibleParser<BlockNode> = block(false)
export const blockPredicate: core.InfallibleParser<BlockNode> = block(true)

export const component = json.parser.json()
export const component = json.parser.json

function double(
min = DoubleMin,
Expand Down
2 changes: 1 addition & 1 deletion packages/json/src/parser/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { json } from './entry.js'
export const array: core.Parser<JsonArrayNode> = (src, ctx) => {
const parser = core.list({
start: '[',
value: json(),
value: json,
sep: ',',
trailingSep: false,
end: ']',
Expand Down
5 changes: 3 additions & 2 deletions packages/json/src/parser/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const LegalNumberStart = new Set([
'9',
'-',
])
export function json(dumpErrors = false): core.Parser<JsonNode> {
export function jsonParser(dumpErrors = false): core.Parser<JsonNode> {
return (src, ctx) => {
const result = core.select([
{ predicate: (src) => src.tryPeek('['), parser: array },
Expand All @@ -44,4 +44,5 @@ export function json(dumpErrors = false): core.Parser<JsonNode> {
}
}

export const entry: core.Parser<JsonNode> = json(true)
export const entry = jsonParser(true)
export const json = jsonParser()
2 changes: 1 addition & 1 deletion packages/json/src/parser/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const object: core.InfallibleParser<JsonObjectNode> = (src, ctx) => {
pair: {
key: string,
sep: ':',
value: json(),
value: json,
end: ',',
trailingEnd: false,
},
Expand Down

0 comments on commit 5bffcff

Please sign in to comment.