Switch from # to @ as comment-start character

This commit is contained in:
Rene Saarsoo 2020-09-30 22:29:41 +03:00
parent 49638c6c71
commit eef96cce92
5 changed files with 42 additions and 43 deletions

View File

@ -4,6 +4,5 @@
- FreeRide blocks - FreeRide blocks
- Repeats (and nested repeats) - Repeats (and nested repeats)
- Change # to @
- Unsupported params: message duration & y-position - Unsupported params: message duration & y-position
- More restricted syntax for text (with quotes) - More restricted syntax for text (with quotes)

View File

@ -1,35 +1,35 @@
Name: Workout with comments Name: Workout with comments
Warmup: 10:00 25%..75% Warmup: 10:00 25%..75%
# 0:10 Welcome to: #8 @ 0:10 Welcome to: #8
# 6:00 Let's talk about today's workout @ 6:00 Let's talk about today's workout
# 6:10 We'll be doing 5 blocks of VO2max work @ 6:10 We'll be doing 5 blocks of VO2max work
# 6:20 Each block 2 minutes and 30 seconds @ 6:20 Each block 2 minutes and 30 seconds
# 6:30 30 seconds more than last time :) @ 6:30 30 seconds more than last time :)
# 6:40 Finally we finish off with 10 minutes of threshold work @ 6:40 Finally we finish off with 10 minutes of threshold work
# 6:50 Easy as that :) @ 6:50 Easy as that :)
Interval: 0:30 95% 95rpm 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 Rest: 0:30 50% 85rpm
# 0:00 Rest a bit @ 0:00 Rest a bit
Interval: 2:30 115% 105rpm Interval: 2:30 115% 105rpm
# 0:00 Here we go! @ 0:00 Here we go!
# 1:00 First minute done @ 1:00 First minute done
# 2:00 Just 30 seconds more @ 2:00 Just 30 seconds more
# 2:20 Finish it! @ 2:20 Finish it!
Rest: 3:00 50% 85rpm Rest: 3:00 50% 85rpm
# 0:00 Good! @ 0:00 Good!
# 0:10 Rest for 3 minutes @ 0:10 Rest for 3 minutes
# 2:50 Ready for next round? @ 2:50 Ready for next round?
Cooldown: 7:30 90%..25% Cooldown: 7:30 90%..25%
# 0:00 We'll now gradually decrease the power @ 0:00 We'll now gradually decrease the power
# 0:10 It's all downhill from here :) @ 0:10 It's all downhill from here :)
# 0:20 until you're cooled down @ 0:20 until you're cooled down
# 7:10 Thanks for participating @ 7:10 Thanks for participating
# 7:20 Until next time! @ 7:20 Until next time!

View File

@ -21,29 +21,29 @@ Interval: 12:00 90rpm 90%
Rest: 4:00 85rpm 55% Rest: 4:00 85rpm 55%
Interval: 1:00 60rpm 90% Interval: 1:00 60rpm 90%
# 00:00 Start off at slow cadence @ 00:00 Start off at slow cadence
Interval: 1:00 90rpm 90% Interval: 1:00 90rpm 90%
# 00:00 Now bump that cadence up @ 00:00 Now bump that cadence up
Interval: 1:00 60rpm 90% Interval: 1:00 60rpm 90%
# 00:00 Back to 60 RPM @ 00:00 Back to 60 RPM
Interval: 1:00 90rpm 90% Interval: 1:00 90rpm 90%
# 00:00 Back to normal cadence @ 00:00 Back to normal cadence
Interval: 1:00 60rpm 90% Interval: 1:00 60rpm 90%
# 00:00 Grinding... @ 00:00 Grinding...
Interval: 1:00 90rpm 90% Interval: 1:00 90rpm 90%
# 00:00 Back to normal cadence @ 00:00 Back to normal cadence
Interval: 1:00 60rpm 90% 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% Interval: 1:00 90rpm 90%
# 00:00 Back to 90 RPM @ 00:00 Back to 90 RPM
Interval: 1:00 60rpm 90% 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% 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% Interval: 1:00 60rpm 90%
# 00:00 Last grinding minute @ 00:00 Last grinding minute
Interval: 1:00 90rpm 90% Interval: 1:00 90rpm 90%
# 00:00 Last minute... be strong! @ 00:00 Last minute... be strong!
Rest: 4:00 85rpm 55% Rest: 4:00 85rpm 55%

View File

@ -341,17 +341,17 @@ Cooldown: 5:30 70%..45%
parse(` parse(`
Name: My Workout Name: My Workout
Interval: 10:00 90% Interval: 10:00 90%
# 0:00 Find your rythm. @ 0:00 Find your rythm.
# 1:00 Try to settle in for the effort @ 1:00 Try to settle in for the effort
# 5:00 Half way through @ 5:00 Half way through
# 9:00 Almost there @ 9:00 Almost there
# 9:30 Final push. YOU GOT IT! @ 9:30 Final push. YOU GOT IT!
Rest: 5:00 50% Rest: 5:00 50%
# 0:00 Great effort! @ 0:00 Great effort!
# 0:30 Cool down well after all of this. @ 0:30 Cool down well after all of this.
`), `),
).toMatchInlineSnapshot(` ).toMatchInlineSnapshot(`
Object { Object {

View File

@ -89,7 +89,7 @@ const tokenizeParams = (text: string, loc: SourceLocation): Token[] => {
}; };
const tokenizeComment = (line: string, row: number): Token[] | undefined => { 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) { if (!commentHead) {
return undefined; return undefined;
} }
@ -97,7 +97,7 @@ const tokenizeComment = (line: string, row: number): Token[] | undefined => {
throw new ParseError("Invalid comment offset", { row, col: commentHead.length }); throw new ParseError("Invalid comment offset", { row, col: commentHead.length });
} }
return [ 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: "duration", value: toSeconds(offset), loc: { row, col: commentHead.length } },
{ type: "text", value: commentText.trim(), loc: { row, col: commentHead.length + offset.length } }, { type: "text", value: commentText.trim(), loc: { row, col: commentHead.length + offset.length } },
]; ];