remove src lifetime from LexableTokennightly-2020.09.20
commitcdeb18af29f912a2cfcd935d36795b50b31cb681
authorSteve Cao <[email protected]>
Sat, 19 Sep 2020 23:04:44 +0000 (19 16:04 -0700)
committerFacebook GitHub Bot <[email protected]>
Sat, 19 Sep 2020 23:07:28 +0000 (19 16:07 -0700)
treee04a00f35b6f401e1508343ca5be74a2655d9727
parent1e173e51e7901e19af6706cdb4c5ccb633cbddc6
remove src lifetime from LexableToken

Summary:
currently there is a `'src` lifetime associated with `LexableToken`. The lifetime was added when editable positioned syntax was added. Editable positioned token embeds a reference of the actual text from source text, `'src` is the lifetime for the text.

All members from `LexableToken` doesn't need this lifetime except `make` function. `make` is called in parser, it should only takes a minimal set of arguments, which are only available during parsing. `source_text` are always the same to all tokens in the same file, which can be set outside of parser.

This lifetime are carried all over parser codebase, for example, `LexablePositionedToken` are also parameterized by the lifetime, none of its members use it.

 If an implementation of `LexableToken` has to take a reference of source text, it can do it locally in an implementation of `SyntaxTypeBase`, since `make_token` takes a context parameter.

This lifetime was added before context parameter was added to `SyntaxTypeBase`, without context, adding `'src` seems the only solution.

Editable positioned syntax is also removed, it was an intern project and never finished. If we do need to port it rust, we can design it better.

Differential Revision: D23729368

fbshipit-source-id: f9f283c887f82fe2e7810d0659946924c7b5b938
39 files changed:
hphp/hack/src/decl/direct_decl_smart_constructors_generated.rs
hphp/hack/src/facts/facts_smart_constructors_generated.rs
hphp/hack/src/generate_full_fidelity_data.ml
hphp/hack/src/parser/cargo/editable_positioned_syntax/Cargo.toml [deleted file]
hphp/hack/src/parser/compact_token.rs
hphp/hack/src/parser/core/declaration_parser.rs
hphp/hack/src/parser/core/expression_parser.rs
hphp/hack/src/parser/core/lexer.rs
hphp/hack/src/parser/core/parser.rs
hphp/hack/src/parser/core/parser_trait.rs
hphp/hack/src/parser/core/statement_parser.rs
hphp/hack/src/parser/core/type_parser.rs
hphp/hack/src/parser/decl_mode_smart_constructors.rs
hphp/hack/src/parser/decl_mode_smart_constructors_generated.rs
hphp/hack/src/parser/editable_positioned_original_source_data.rs [deleted file]
hphp/hack/src/parser/editable_positioned_syntax.rs [deleted file]
hphp/hack/src/parser/editable_positioned_syntax_to_ocaml.rs [deleted file]
hphp/hack/src/parser/editable_positioned_token.rs [deleted file]
hphp/hack/src/parser/flatten_smart_constructors.rs
hphp/hack/src/parser/lexable_token.rs
hphp/hack/src/parser/lowerer/lowerer.rs
hphp/hack/src/parser/lowerer/scour_comment.rs
hphp/hack/src/parser/minimal_smart_constructors.rs
hphp/hack/src/parser/minimal_token.rs
hphp/hack/src/parser/ocaml_syntax.rs
hphp/hack/src/parser/ocaml_syntax_generated.rs
hphp/hack/src/parser/positioned_smart_constructors.rs
hphp/hack/src/parser/positioned_token.rs
hphp/hack/src/parser/rust_parser_errors.rs
hphp/hack/src/parser/rust_parser_ffi.rs
hphp/hack/src/parser/rust_to_ocaml.rs
hphp/hack/src/parser/smart_constructors_generated.rs
hphp/hack/src/parser/smart_constructors_wrappers.rs
hphp/hack/src/parser/syntax.rs
hphp/hack/src/parser/syntax_generated.rs
hphp/hack/src/parser/syntax_smart_constructors_generated.rs
hphp/hack/src/parser/syntax_tree.rs
hphp/hack/src/parser/syntax_type.rs
hphp/hack/src/parser/verify_smart_constructors_generated.rs