Remove direct usage of Syntax module from parsers
Summary:
Because we are going to use smart constructors instead of `Syntax.make_` functions we can't inspect created nodes anymore. Parsers will be parametrized by smart constructors and couldn't assume `SC.r` (return value from `Make` functions) to be `Syntax.t`. That's why we have to remove all the calls to `Syntax` from parsers.
Changes
1. Removed call to `Syntax.is_namespace_prefix_name`. You pass a `QualifiedName` and it will extract `ItemList` and check if the last separator is not missing.
Now we just propagate this information from the place where we actually create items.
*Note*. if you look at the `scan_qualified_name` and `scan_extended_qualified_name` you'll see that the only separator they accept is backslash, so I called propagated parameter `is_backslash`.
2. Now `require_name_allow_std_constants` is extracting offsets from the lexer to get text of the token. To check off-by-one errors I modified `hphp/hack/test/full_fidelity/cases/test_group_use_errors.php` include that code-path and ran `ocamldebug`.
3. Rewrote `parse_string_literal` to postpone token creation. Now it's calling `make_token` only when it's sure that token is never gonna change. Previously it was using `Syntax.get_token` and `make_token` to add new tokens to the string literal.
Differential Revision:
D6894426
fbshipit-source-id:
d8eb326106281f6acc69bb6670fa2fb86b19a8e1