From 0d2d8618960935a1fec7a0297bfd1366fcfb2877 Mon Sep 17 00:00:00 2001 From: youngcw <calebyoung94@gmail.com> Date: Thu, 25 May 2023 04:06:35 -0700 Subject: [PATCH] Goals: fix broken parser (#1059) --- .../src/server/budget/goal-template.pegjs | 14 ++++++++------ upcoming-release-notes/1059.md | 6 ++++++ 2 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 upcoming-release-notes/1059.md diff --git a/packages/loot-core/src/server/budget/goal-template.pegjs b/packages/loot-core/src/server/budget/goal-template.pegjs index 2efb87f54..28ce8741c 100644 --- a/packages/loot-core/src/server/budget/goal-template.pegjs +++ b/packages/loot-core/src/server/budget/goal-template.pegjs @@ -1,9 +1,11 @@ +// https://peggyjs.org + expr - = priority: priority? percent: percent _ of _ category: name + = priority: priority? _? percent: percent _ of _ category: name { return { type: 'percentage', percent: +percent, category, priority: +priority }} - / priority: priority? amount: amount _ repeatEvery _ weeks: weekCount _ starting _ starting: date limit: limit? + / priority: priority? _? amount: amount _ repeatEvery _ weeks: weekCount _ starting _ starting: date limit: limit? { return { type: 'week', amount, weeks, starting, limit, priority: +priority }} - / priority: priority? amount: amount _ by _ month: month from: spendFrom? repeat: (_ repeatEvery _ repeat)? + / priority: priority? _? amount: amount _ by _ month: month from: spendFrom? repeat: (_ repeatEvery _ repeat)? { return { type: from ? 'spend' : 'by', amount, @@ -12,11 +14,11 @@ expr from, priority: +priority } } - / priority: priority? monthly: amount limit: limit? + / priority: priority? _? monthly: amount limit: limit? { return { type: 'simple', monthly, limit, priority: +priority } } - / priority: priority? limit: limit + / priority: priority? _? limit: limit { return { type: 'simple', limit , priority: +priority } } - / priority: priority? schedule _ full:full? name: name + / priority: priority? _? schedule _ full:full? name: name { return { type: 'schedule', name, priority: +priority, full } } diff --git a/upcoming-release-notes/1059.md b/upcoming-release-notes/1059.md new file mode 100644 index 000000000..70cc325c9 --- /dev/null +++ b/upcoming-release-notes/1059.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [youngcw] +--- + +Goals: Undo change that broke some template parsing -- GitLab