mirror of
https://github.com/imjasonh/nescript
synced 2026-07-08 08:55:38 +00:00
Parser: audio statements (play / start_music / stop_music)
The \`play\`, \`start_music\`, and \`stop_music\` keywords were lexed
but not parsed. Programs using them failed with a generic "unexpected
token" error. Now:
- \`Statement::Play(sfx_name, span)\`
- \`Statement::StartMusic(track_name, span)\`
- \`Statement::StopMusic(span)\`
parse successfully and flow through analyzer / IR lowering / codegen
as no-ops. Semantics match the spec but produce no output — no audio
driver exists yet. Users who need sound can still wire in custom
code via \`asm { ... }\` blocks.
https://claude.ai/code/session_01W6eQFStA66EuMKHUFo2rx3
This commit is contained in:
parent
59970a4a45
commit
e16b765959
6 changed files with 67 additions and 2 deletions
|
|
@ -899,6 +899,23 @@ impl Parser {
|
|||
Ok(Statement::Scroll(x, y, span))
|
||||
}
|
||||
TokenKind::KwDebug => self.parse_debug_statement(),
|
||||
TokenKind::KwPlay => {
|
||||
let span = self.current_span();
|
||||
self.advance();
|
||||
let (name, _) = self.expect_ident()?;
|
||||
Ok(Statement::Play(name, span))
|
||||
}
|
||||
TokenKind::KwStartMusic => {
|
||||
let span = self.current_span();
|
||||
self.advance();
|
||||
let (name, _) = self.expect_ident()?;
|
||||
Ok(Statement::StartMusic(name, span))
|
||||
}
|
||||
TokenKind::KwStopMusic => {
|
||||
let span = self.current_span();
|
||||
self.advance();
|
||||
Ok(Statement::StopMusic(span))
|
||||
}
|
||||
TokenKind::KwAsm => {
|
||||
let span = self.current_span();
|
||||
self.advance(); // KwAsm
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue