Add parser support for generators.
authormstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 2 Apr 2013 17:34:59 +0000 (17:34 +0000)
committermstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 2 Apr 2013 17:34:59 +0000 (17:34 +0000)
commit2816f1968020b93be8190f8611b27e010da12174
tree50b730c28ef9a248fa4779c3fedcc13ae4614fc8
parent7e90cfb10d6025c8e3cb56a09a477a283a138e7d
Add parser support for generators.

This patchset begins by adding support for "yield", which is unlike other tokens
in JS. In a generator, whether strict or classic, it is a syntactic keyword.
In classic mode it is an identifier. In strict mode it is reserved.

This patch adds YIELD as a token to the scanner, and adapts the preparser and
parser appropriately. It also parses "function*", indicating that a function is
actually a generator, for both eagerly and lazily parsed functions.

Currently "yield" just compiles as "return".

BUG=v8:2355
TEST=mjsunit/harmony/generators-parsing

Review URL: https://codereview.chromium.org/12646003
Patch from Andy Wingo <wingo@igalia.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14116 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
17 files changed:
src/ast.cc
src/ast.h
src/compiler.cc
src/flag-definitions.h
src/full-codegen.cc
src/hydrogen.cc
src/objects-inl.h
src/objects.h
src/parser.cc
src/parser.h
src/preparser.cc
src/preparser.h
src/prettyprinter.cc
src/scanner.cc
src/scanner.h
src/token.h
test/mjsunit/harmony/generators-parsing.js [new file with mode: 0644]