I just checked the parser and it is broken for both comments and operators in compound initialisers, (so you can't use the OR statement). I have fixed it my end in my current version of the compiler, but that it isn't going to be released for a while.
If you need comments and operators within compound initialisers and are willing to make a couple of gtBASIC source code changes and do a re-compile, then I can show you which files to modify here.
This is for Ver 1.0.9R, (Release, runtime 0104), which is the current version in the main gigatron repo under Contrib/at67.
Comment out line 2529 in keywords.cpp, so it should look like this:
Code: Select all
std::string initText = codeLine._code.substr(equalsPos + 1);
//Expression::stripWhitespace(initText);
std::vector<std::string> initTokens = Expression::tokenise(initText, ',', true);
Modify lines 333 to 346 in compiler.cpp, so that it changes from this:
Code: Select all
std::getline(infile, lineToken);
Input inp = {true, lineToken};
// Compound statement must span multiple lines
size_t lbra, rbra;
lineToken = Expression::removeCommentsNotInStrings(lineToken);
if(Expression::findMatchingBrackets(lineToken, 0, lbra, rbra, '{'))
{
fprintf(stderr, "Compiler::readInputFile() : '%s:%d' : compound statement must span multiple lines\n", filename.c_str(), numLines+1);
return false;
}
// Append lines into a compound statement
int compoundLength = 0;
To this:
Code: Select all
// Compound statement must span multiple lines
size_t lbra, rbra;
std::getline(infile, lineToken);
lineToken = Expression::removeCommentsNotInStrings(lineToken);
if(Expression::findMatchingBrackets(lineToken, 0, lbra, rbra, '{'))
{
fprintf(stderr, "Compiler::readInputFile() : '%s:%d' : compound statement must span multiple lines\n", filename.c_str(), numLines+1);
return false;
}
// Append lines into a compound statement
int compoundLength = 0;
Input inp = {true, lineToken};
Then recompile.