aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2010-12-14 18:52:09 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2010-12-14 18:52:09 +0000
commit7ed66e6669a256d701ea2b41c5ec340729d3aeca (patch)
treeb3ce30aecbf3412ef88f0edf440a66b2283a8e81
parent894503cb3174b232a287581cfa2030139efce614 (diff)
downloadgcc-7ed66e6669a256d701ea2b41c5ec340729d3aeca.zip
gcc-7ed66e6669a256d701ea2b41c5ec340729d3aeca.tar.gz
gcc-7ed66e6669a256d701ea2b41c5ec340729d3aeca.tar.bz2
Insert semicolon at EOF if necessary.
From-SVN: r167809
-rw-r--r--gcc/go/gofrontend/lex.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc
index bc2531e..ad1a1fe 100644
--- a/gcc/go/gofrontend/lex.cc
+++ b/gcc/go/gofrontend/lex.cc
@@ -542,7 +542,13 @@ Lex::next_token()
while (true)
{
if (!this->require_line())
- return this->make_eof_token();
+ {
+ bool add_semi_at_eol = this->add_semi_at_eol_;
+ this->add_semi_at_eol_ = false;
+ if (add_semi_at_eol)
+ return this->make_operator(OPERATOR_SEMICOLON, 1);
+ return this->make_eof_token();
+ }
const char* p = this->linebuf_ + this->lineoff_;
const char* pend = this->linebuf_ + this->linesize_;