BrettMayson / HEMTT

Build System for Arma 3
http://hemtt.dev/
GNU General Public License v2.0
115 stars 40 forks source link

Preprocessor fails when creating a custom CfgMusic class #448

Closed k-e-l-p closed 1 year ago

k-e-l-p commented 1 year ago

config.cpp:

class CfgMusic {
    tracks[] = {};

    class klpq_musicRadio_02c9fdbd4bcf1c4e3bdb0d7bc371ef4b {
        name = "[12th] A Walk In The Woods";
        sound[] = {"12thMusic\Music\A Walk In The Woods.ogg", db+3, 1};
        tag = "klpq_musicRadio_v1";
        theme = "Music";
        duration = 117;
        artist = "Martin O'Donnell, Michael Salvatori, Jafet Meza, Séamus Bradd & Robbie Johnson";
        title = "A Walk In The Woods";
        klpq_ignoreTrack = 1;
        musicClass = "12th_Marines";
    };
    class klpq_musicRadio_a8942e8173d151b45f13b1c580269b4a {
        name = "[12th] Alien Corridors";
        sound[] = {"12thMusic\Music\Alien Corridors.ogg", db+3, 1};
        tag = "klpq_musicRadio_v1";
        theme = "Music";
        duration = 110;
        artist = "Martin O'Donnell, Michael Salvatori, Jafet Meza, Séamus Bradd & Robbie Johnson";
        title = "Alien Corridors";
        klpq_ignoreTrack = 1;
        musicClass = "12th_Marines";
    };
}

hemtt dev output:

error for unexpected token: Token { symbol: Word("db"), source: Position { start: (419, (18, 63)), end: (421, (18, 65)), path: "/addons/12thMusic/config.cpp" }, parent: None }
error: Config error: Expected `[LeftBrace, DoubleQuote, Digit(0)]`, found `Token { symbol: Word("db"), source: Position { start: (419, (18, 63)), end: (421, (18, 65)), path: "/addons/12thMusic/config.cpp" }, parent: None }`,

   --> addons/12thMusic/config.cpp:18:63
    |
 18 |         sound[] = {"12thMusic\Music\A Walk In The Woods.ogg", db+3, 1};
    |                                                               ^ expected one of: [LeftBrace, DoubleQuote, Digit(0)]
help: Did you forget to place quotes around a string? Or perhaps you forgot to define / import a value.

The same file works when using the official Arma tools.

BrettMayson commented 1 year ago

This is intentional, as HEMTT will not support auto-quotes. As the help text says, you just need to add quotes.

 sound[] = {"12thMusic\Music\A Walk In The Woods.ogg", "db+3", 1};