mirror of
https://github.com/imjasonh/nescript
synced 2026-07-18 14:45:58 +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
|
|
@ -974,6 +974,11 @@ impl Analyzer {
|
|||
// codegen parses and validates the body; analysis has
|
||||
// nothing to check.
|
||||
}
|
||||
Statement::Play(_, _) | Statement::StartMusic(_, _) | Statement::StopMusic(_) => {
|
||||
// Audio statements are parsed and recognized but
|
||||
// currently generate no code — no audio driver exists.
|
||||
// Users who need audio can use inline `asm` blocks.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1219,7 +1224,10 @@ fn collect_calls_stmt(stmt: &Statement, calls: &mut Vec<String>) {
|
|||
| Statement::Continue(_)
|
||||
| Statement::LoadBackground(_, _)
|
||||
| Statement::SetPalette(_, _)
|
||||
| Statement::InlineAsm(_, _) => {}
|
||||
| Statement::InlineAsm(_, _)
|
||||
| Statement::Play(_, _)
|
||||
| Statement::StartMusic(_, _)
|
||||
| Statement::StopMusic(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue