Ban backtick from being parsed as a string
commit6c9941bdb34c453bf58a2bb47f7c745d57bdb15e
authorThomas Jiang <thomasjiang@fb.com>
Thu, 16 Jul 2020 20:31:24 +0000 (16 13:31 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 16 Jul 2020 20:36:00 +0000 (16 13:36 -0700)
treea3159e6593a82c809210cc83c25ecd05ad52491c
parentd7bcda23775ab9cbc48d691c5ecea37d6f5b2a66
Ban backtick from being parsed as a string

Summary:
Backticks are currently being lexed equivalently to double quotes. The lexer even returns the same token kind to the parser: either `TokenKind::DoubleQuotedStringLiteral` or `TokenKind::DoubleQuotedStringLiteralHead`.

This diff removes backtick from being lexed like double quote. We could throw this error after we've constructed the parse tree - but that requires us creating a new TokenKind for backtick or inspecting the text of the token in the parser. Neither solution seems like a good fit to simply throwing an error when we see backticks.

Reviewed By: Wilfred

Differential Revision: D22562252

fbshipit-source-id: fdcdbf45816c3d6e2ccb3f02510252c5c8ea9bc3
hphp/hack/src/parser/core/lexer.rs
hphp/hack/test/full_fidelity/cases/backtick.php [new file with mode: 0644]
hphp/hack/test/full_fidelity/cases/backtick.php.errors.exp [new file with mode: 0644]
hphp/hack/test/full_fidelity/cases/backtick.php.json.exp [new file with mode: 0644]