s2s2lua 0.1.0

Transpile Stranded II .s2s scripts to Lua for OpenStranded
Documentation
// s2s2lua – transpile Stranded II .s2s scripts to Lua for OpenStranded
// Copyright (C) 2025  s2s2lua contributors
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

use super::*;

impl S2sParser {
    // ── Block parsing ─────────────────────────────────────

    /// Parse statements until a closing '}'.
    pub(super) fn parse_block(lexer: &mut S2sLexer) -> S2sResult<Vec<Stmt>> {
        let mut statements = Vec::new();
        loop {
            match lexer.peek() {
                Some((Token::RBrace, _)) => {
                    let _ = lexer.next_token();
                    break;
                }
                Some((_, _)) => {
                    statements.push(Self::parse_statement(lexer)?);
                }
                None => {
                    return Err(Self::error(lexer, 0, "unterminated block, expected '}'"));
                }
            }
        }
        Ok(statements)
    }
}