diff options
Diffstat (limited to 'lib/Parser/ParserFile.cc')
| -rw-r--r-- | lib/Parser/ParserFile.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Parser/ParserFile.cc b/lib/Parser/ParserFile.cc index 6fd368c..4a4ae31 100644 --- a/lib/Parser/ParserFile.cc +++ b/lib/Parser/ParserFile.cc @@ -57,6 +57,14 @@ std::unique_ptr<StmtAST> Parser::ParseReadFile() { std::string VarName = Lex.IdentifierStr; getNextToken(); // eat the variable name + if (CurTok == '[' || CurTok == '.' || CurTok == '^') { + // Consume the whole designator so it cannot replay as statements. + std::vector<DesignatorAccess> Dummy; + ParseDesignatorSuffix(Dummy); + fprintf(stderr, "Error: READFILE target must be a plain STRING variable at line %d\n", Line); + return nullptr; + } + return std::make_unique<ReadFileStmtAST>(std::move(FileName), VarName, Line); } |
