diff options
Diffstat (limited to 'graphics/src/audio/parse')
| -rw-r--r-- | graphics/src/audio/parse/lex.rs | 7 | ||||
| -rw-r--r-- | graphics/src/audio/parse/parser.rs | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/graphics/src/audio/parse/lex.rs b/graphics/src/audio/parse/lex.rs index f2500da..a349c53 100644 --- a/graphics/src/audio/parse/lex.rs +++ b/graphics/src/audio/parse/lex.rs @@ -13,6 +13,7 @@ pub enum Token { LineSeparator, Pause(usize), Jump(usize), + Tempo(u32), ChanSpec(ChanSpec), SetVolume(u8), SetPitch(u8), @@ -96,11 +97,11 @@ impl<'s> Lexer<'s> { }?; let off = match self.peek()? { - 's' => { + '#' => { self.next()?; 1 } - 'f' => { + 'b' => { self.next()?; -1 } @@ -178,6 +179,8 @@ impl<'s> Lexer<'s> { '-' => self.next_pause()?, // jump 'j' => T::Jump(self.next_int()?), + // tempO + 'o' => T::Tempo(self.next_int()?), // eof '\0' => T::Eof, // new line diff --git a/graphics/src/audio/parse/parser.rs b/graphics/src/audio/parse/parser.rs index fbe5f4c..23ba8a4 100644 --- a/graphics/src/audio/parse/parser.rs +++ b/graphics/src/audio/parse/parser.rs @@ -87,6 +87,10 @@ impl<'s> Parser<'s> { self.next()?; prog.push(Instruction::Jump(pc)); } + Token::Tempo(tempo) => { + self.next()?; + prog.push(Instruction::Tempo(tempo)); + } _ => self.parse_line(&mut prog)?, } } |