Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR the general idea is to separate the AST, parser, and friends by a more data / logic structure (tho not fully realized!) by separating out the parser and macro expansion code from libsyntax. Specifically have now three crates instead of one (libsyntax):
libsyntax:
concrete syntax tree (
syntax::ast)definition of tokens and token-streams (
syntax::{token, tokenstream}) -- used bysyntax::astvisitors (
syntax::visit,syntax::mut_visit)shared definitions between
libsyntax_expandfeature gating (
syntax::feature_gate) -- we could possibly move this out to its own crater later.attribute and meta item utilities, including used-marking (
syntax::attr)pretty printer (
syntax::print) -- this should possibly be moved out later. For now I've reduced down the dependencies to a single essential one which could be broken viaParseSess. This entails that e.g.Debugimpls forPathcannot reference the pretty printer.definition of
ParseSess(syntax::sess) -- this is used bysyntax::{attr, print, feature_gate}and is a common definition used by the parser and other things like librustc.the
syntax::source_map-- this includes definitions used bysyntax::astand other things but could ostensibly be movedsyntax_possince that is more related to this module.a smattering of misc utilities not sufficiently important to itemize -- some of these could be moved to where they are used (often a single place) but I wanted to limit the scope of this PR.
librustc_parse:
parser (
rustc_parse::parser) -- reading a file and such are defined in the crate root tho.lexer (
rustc_parse::lexer)validation of meta grammar (post-expansion) in (
rustc_parse::validate_attr)libsyntax_expand -- this defines the infra for macro expansion and conditional compilation but this is not libsyntax_ext; we might want to merge them later but currently libsyntax_expand is depended on by librustc_metadata which libsyntax_ext is not.
conditional compilation (
syntax_expand::config) -- moved fromsyntax::configto herethe bulk of this crate is made up of the old
syntax::extr? @estebank