aboutsummaryrefslogtreecommitdiff
path: root/lib/Parser/Parser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Parser/Parser.cc')
-rw-r--r--lib/Parser/Parser.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Parser/Parser.cc b/lib/Parser/Parser.cc
index 9563650..260472c 100644
--- a/lib/Parser/Parser.cc
+++ b/lib/Parser/Parser.cc
@@ -542,7 +542,15 @@ std::unique_ptr<StmtAST> Parser::ParseStatementImpl() {
return nullptr;
}
std::string Name = Lex.IdentifierStr;
+ int Line = Lex.getLine();
getNextToken();
+ if (CurTok == '[' || CurTok == '.' || CurTok == '^') {
+ // Consume the whole designator so it cannot replay as statements.
+ std::vector<DesignatorAccess> Dummy;
+ ParseDesignatorSuffix(Dummy);
+ fprintf(stderr, "Error: INPUT target must be a plain variable at line %d\n", Line);
+ return nullptr;
+ }
return std::make_unique<InputStmtAST>(Name);
}
else if (CurTok == tok_output) {