diff --git a/README.md b/README.md index 8ef10ab..4bcf888 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,5 @@ - FreeRide blocks - Repeats (and nested repeats) -- Change # to @ - Unsupported params: message duration & y-position - More restricted syntax for text (with quotes) diff --git a/examples/comments.txt b/examples/comments.txt index ae5194f..9c916a4 100644 --- a/examples/comments.txt +++ b/examples/comments.txt @@ -1,35 +1,35 @@ Name: Workout with comments Warmup: 10:00 25%..75% - # 0:10 Welcome to: #8 - # 6:00 Let's talk about today's workout - # 6:10 We'll be doing 5 blocks of VO2max work - # 6:20 Each block 2 minutes and 30 seconds - # 6:30 30 seconds more than last time :) - # 6:40 Finally we finish off with 10 minutes of threshold work - # 6:50 Easy as that :) + @ 0:10 Welcome to: #8 + @ 6:00 Let's talk about today's workout + @ 6:10 We'll be doing 5 blocks of VO2max work + @ 6:20 Each block 2 minutes and 30 seconds + @ 6:30 30 seconds more than last time :) + @ 6:40 Finally we finish off with 10 minutes of threshold work + @ 6:50 Easy as that :) Interval: 0:30 95% 95rpm - # 0:00 Spin to 95 RPM if you're not already there + @ 0:00 Spin to 95 RPM if you're not already there Rest: 0:30 50% 85rpm - # 0:00 Rest a bit + @ 0:00 Rest a bit Interval: 2:30 115% 105rpm - # 0:00 Here we go! - # 1:00 First minute done - # 2:00 Just 30 seconds more - # 2:20 Finish it! + @ 0:00 Here we go! + @ 1:00 First minute done + @ 2:00 Just 30 seconds more + @ 2:20 Finish it! Rest: 3:00 50% 85rpm - # 0:00 Good! - # 0:10 Rest for 3 minutes - # 2:50 Ready for next round? + @ 0:00 Good! + @ 0:10 Rest for 3 minutes + @ 2:50 Ready for next round? Cooldown: 7:30 90%..25% - # 0:00 We'll now gradually decrease the power - # 0:10 It's all downhill from here :) - # 0:20 until you're cooled down - # 7:10 Thanks for participating - # 7:20 Until next time! + @ 0:00 We'll now gradually decrease the power + @ 0:10 It's all downhill from here :) + @ 0:20 until you're cooled down + @ 7:10 Thanks for participating + @ 7:20 Until next time! diff --git a/examples/halvfems.txt b/examples/halvfems.txt index 00d54af..d7723c9 100644 --- a/examples/halvfems.txt +++ b/examples/halvfems.txt @@ -21,29 +21,29 @@ Interval: 12:00 90rpm 90% Rest: 4:00 85rpm 55% Interval: 1:00 60rpm 90% - # 00:00 Start off at slow cadence + @ 00:00 Start off at slow cadence Interval: 1:00 90rpm 90% - # 00:00 Now bump that cadence up + @ 00:00 Now bump that cadence up Interval: 1:00 60rpm 90% - # 00:00 Back to 60 RPM + @ 00:00 Back to 60 RPM Interval: 1:00 90rpm 90% - # 00:00 Back to normal cadence + @ 00:00 Back to normal cadence Interval: 1:00 60rpm 90% - # 00:00 Grinding... + @ 00:00 Grinding... Interval: 1:00 90rpm 90% - # 00:00 Back to normal cadence + @ 00:00 Back to normal cadence Interval: 1:00 60rpm 90% - # 00:00 And grind at 60 RPM again + @ 00:00 And grind at 60 RPM again Interval: 1:00 90rpm 90% - # 00:00 Back to 90 RPM + @ 00:00 Back to 90 RPM Interval: 1:00 60rpm 90% - # 00:00 Lower it again to 60 RPM + @ 00:00 Lower it again to 60 RPM Interval: 1:00 90rpm 90% - # 00:00 Increase the cadence to 90 RPM + @ 00:00 Increase the cadence to 90 RPM Interval: 1:00 60rpm 90% - # 00:00 Last grinding minute + @ 00:00 Last grinding minute Interval: 1:00 90rpm 90% - # 00:00 Last minute... be strong! + @ 00:00 Last minute... be strong! Rest: 4:00 85rpm 55% diff --git a/src/parser/parser.test.ts b/src/parser/parser.test.ts index bc20dab..6ccfe42 100644 --- a/src/parser/parser.test.ts +++ b/src/parser/parser.test.ts @@ -341,17 +341,17 @@ Cooldown: 5:30 70%..45% parse(` Name: My Workout Interval: 10:00 90% - # 0:00 Find your rythm. - # 1:00 Try to settle in for the effort + @ 0:00 Find your rythm. + @ 1:00 Try to settle in for the effort - # 5:00 Half way through + @ 5:00 Half way through - # 9:00 Almost there - # 9:30 Final push. YOU GOT IT! + @ 9:00 Almost there + @ 9:30 Final push. YOU GOT IT! Rest: 5:00 50% - # 0:00 Great effort! - # 0:30 Cool down well after all of this. + @ 0:00 Great effort! + @ 0:30 Cool down well after all of this. `), ).toMatchInlineSnapshot(` Object { diff --git a/src/parser/tokenizer.ts b/src/parser/tokenizer.ts index b40c790..2884857 100644 --- a/src/parser/tokenizer.ts +++ b/src/parser/tokenizer.ts @@ -89,7 +89,7 @@ const tokenizeParams = (text: string, loc: SourceLocation): Token[] => { }; const tokenizeComment = (line: string, row: number): Token[] | undefined => { - const [, commentHead, offset, commentText] = line.match(/^(\s*#\s*)([0-9:]+)(.*?)$/) || []; + const [, commentHead, offset, commentText] = line.match(/^(\s*@\s*)([0-9:]+)(.*?)$/) || []; if (!commentHead) { return undefined; } @@ -97,7 +97,7 @@ const tokenizeComment = (line: string, row: number): Token[] | undefined => { throw new ParseError("Invalid comment offset", { row, col: commentHead.length }); } return [ - { type: "comment-start", loc: { row, col: line.indexOf("#") } }, + { type: "comment-start", loc: { row, col: line.indexOf("@") } }, { type: "duration", value: toSeconds(offset), loc: { row, col: commentHead.length } }, { type: "text", value: commentText.trim(), loc: { row, col: commentHead.length + offset.length } }, ];