Skip to content

Commit

Permalink
Merge pull request #580 from hildjj/update-dependencies
Browse files Browse the repository at this point in the history
Update dependencies, fix new inconsequential lint issues
  • Loading branch information
hildjj authored Dec 25, 2024
2 parents 7c6e0c7 + 75f2689 commit f28cbaa
Show file tree
Hide file tree
Showing 5 changed files with 476 additions and 397 deletions.
90 changes: 45 additions & 45 deletions lib/compiler/passes/generate-bytecode.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,14 +742,14 @@ function generateBytecode(ast, options) {
first,
alternatives.length > 1
? buildCondition(
SOMETIMES_MATCH,
[op.IF_ERROR],
buildSequence(
[op.POP],
buildAlternativesCode(alternatives.slice(1), context)
),
[]
)
SOMETIMES_MATCH,
[op.IF_ERROR],
buildSequence(
[op.POP],
buildAlternativesCode(alternatives.slice(1), context)
),
[]
)
: []
);
}
Expand All @@ -774,19 +774,19 @@ function generateBytecode(ast, options) {

return emitCall
? buildSequence(
[op.PUSH_CURR_POS],
expressionCode,
buildCondition(
match,
[op.IF_NOT_ERROR],
buildSequence(
[op.LOAD_SAVED_POS, 1],
buildCall(functionIndex, 1, env, context.sp + 2)
[op.PUSH_CURR_POS],
expressionCode,
buildCondition(
match,
[op.IF_NOT_ERROR],
buildSequence(
[op.LOAD_SAVED_POS, 1],
buildCall(functionIndex, 1, env, context.sp + 2)
),
[]
),
[]
),
[op.NIP]
)
[op.NIP]
)
: expressionCode;
},

Expand Down Expand Up @@ -993,14 +993,14 @@ function generateBytecode(ast, options) {
// Do not generate function for "minimum" if grammar used `exact` syntax
const minCode = node.min
? buildRangeCall(
node.min,
context.env,
context.sp,
// +1 for the result slot with an array
// +1 for the saved position
// +1 if we have a "function" maximum it occupies an additional slot in the stack
2 + (node.max.type === "function" ? 1 : 0)
)
node.min,
context.env,
context.sp,
// +1 for the result slot with an array
// +1 for the saved position
// +1 if we have a "function" maximum it occupies an additional slot in the stack
2 + (node.max.type === "function" ? 1 : 0)
)
: { pre: [], post: [], sp: context.sp };
const maxCode = buildRangeCall(node.max, context.env, minCode.sp, offset);

Expand All @@ -1012,10 +1012,10 @@ function generateBytecode(ast, options) {
const expressionCode = node.delimiter !== null
? generate(node.expression, {
// +1 for the saved position before parsing the `delimiter elem` pair
sp: maxCode.sp + offset + 1,
env: cloneEnv(context.env),
action: null,
})
sp: maxCode.sp + offset + 1,
env: cloneEnv(context.env),
action: null,
})
: firstExpressionCode;
const bodyCode = buildRangeBody(
node.delimiter,
Expand Down Expand Up @@ -1089,16 +1089,16 @@ function generateBytecode(ast, options) {
|| (match === ALWAYS_MATCH && !node.ignoreCase);
const stringIndex = needConst
? literals.add(
node.ignoreCase ? node.value.toLowerCase() : node.value
)
node.ignoreCase ? node.value.toLowerCase() : node.value
)
: -1;
// Expectation not required if node always match
const expectedIndex = (match !== ALWAYS_MATCH)
? expectations.add({
type: "literal",
value: node.value,
ignoreCase: node.ignoreCase,
})
type: "literal",
value: node.value,
ignoreCase: node.ignoreCase,
})
: -1;

// For case-sensitive strings the value must match the beginning of the
Expand Down Expand Up @@ -1126,11 +1126,11 @@ function generateBytecode(ast, options) {
// Expectation not required if node always match
const expectedIndex = (match !== ALWAYS_MATCH)
? expectations.add({
type: "class",
value: node.parts,
inverted: node.inverted,
ignoreCase: node.ignoreCase,
})
type: "class",
value: node.parts,
inverted: node.inverted,
ignoreCase: node.ignoreCase,
})
: -1;

return buildCondition(
Expand All @@ -1146,8 +1146,8 @@ function generateBytecode(ast, options) {
// Expectation not required if node always match
const expectedIndex = (match !== ALWAYS_MATCH)
? expectations.add({
type: "any",
})
type: "any",
})
: -1;

return buildCondition(
Expand Down
33 changes: 13 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,51 +56,44 @@
"version": "npm run set_version && npm run parser && npm run parser && npm run test && npm run examples && git add lib/version.js lib/parser.js docs/index.html test/cli/fixtures/imports_peggy.js test/cli/fixtures/lib.js docs/js/examples.js"
},
"devDependencies": {
"@peggyjs/eslint-config": "^5.0.1",
"@rollup/plugin-commonjs": "^28.0.1",
"@peggyjs/eslint-config": "^5.0.2",
"@rollup/plugin-commonjs": "^28.0.2",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-multi-entry": "^6.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-typescript": "^12.1.1",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-typescript": "^12.1.2",
"@types/chai": "^4.3.11",
"@types/jest": "^29.5.14",
"@types/node": "^22.9.0",
"@types/node": "^22.10.2",
"chai": "^4.3.11",
"chai-like": "^1.1.3",
"copyfiles": "^2.4.1",
"eslint": "^9.15.0",
"eslint-plugin-compat": "6.0.1",
"eslint": "^9.17.0",
"eslint-plugin-compat": "6.0.2",
"eslint-plugin-mocha": "10.5.0",
"express": "4.21.1",
"express": "4.21.2",
"glob": "^11.0.0",
"jest": "^29.7.0",
"package-extract": "2.3.0",
"rimraf": "^5.0.10",
"rollup": "^4.27.3",
"rollup": "^4.29.1",
"rollup-plugin-ignore": "1.0.10",
"source-map": "^0.8.0-beta.0",
"terser": "^5.36.0",
"terser": "^5.37.0",
"ts-jest": "^29.2.5",
"tslib": "^2.8.1",
"typescript": "5.6.3",
"typescript-eslint": "8.15.0"
"typescript": "5.7.2",
"typescript-eslint": "8.18.2"
},
"dependencies": {
"@peggyjs/from-mem": "1.3.5",
"commander": "^12.1.0",
"source-map-generator": "0.8.0"
},
"pnpm": {
"overrides": {
"@eslint/plugin-kit": "^0.2.3",
"cross-spawn": "^7.0.6",
"picomatch": "^4.0.2"
}
},
"browserslist": [
"defaults, maintained node versions, not op_mini all"
],
"packageManager": "pnpm@9.13.2",
"packageManager": "pnpm@9.15.1",
"engines": {
"node": ">=18"
}
Expand Down
Loading

0 comments on commit f28cbaa

Please sign in to comment.