From 4ae2728fa8052915414127dce28245eb8f70842a Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 15 Oct 2019 22:48:13 +0200 Subject: move syntax::parse -> librustc_parse also move MACRO_ARGUMENTS -> librustc_parse --- src/libsyntax/util/comments.rs | 4 ++-- src/libsyntax/util/literal.rs | 10 +++++----- src/libsyntax/util/parser.rs | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/libsyntax/util') diff --git a/src/libsyntax/util/comments.rs b/src/libsyntax/util/comments.rs index ef9226a8879..5e9b7bf8322 100644 --- a/src/libsyntax/util/comments.rs +++ b/src/libsyntax/util/comments.rs @@ -32,14 +32,14 @@ pub struct Comment { pub pos: BytePos, } -crate fn is_line_doc_comment(s: &str) -> bool { +pub fn is_line_doc_comment(s: &str) -> bool { let res = (s.starts_with("///") && *s.as_bytes().get(3).unwrap_or(&b' ') != b'/') || s.starts_with("//!"); debug!("is {:?} a doc comment? {}", s, res); res } -crate fn is_block_doc_comment(s: &str) -> bool { +pub fn is_block_doc_comment(s: &str) -> bool { // Prevent `/**/` from being parsed as a doc comment let res = ((s.starts_with("/**") && *s.as_bytes().get(3).unwrap_or(&b' ') != b'*') || s.starts_with("/*!")) && s.len() >= 5; diff --git a/src/libsyntax/util/literal.rs b/src/libsyntax/util/literal.rs index d4c9b7850c5..af7afab6b9b 100644 --- a/src/libsyntax/util/literal.rs +++ b/src/libsyntax/util/literal.rs @@ -14,7 +14,7 @@ use rustc_lexer::unescape::{unescape_raw_str, unescape_raw_byte_str}; use std::ascii; -crate enum LitError { +pub enum LitError { NotLiteral, LexerError, InvalidSuffix, @@ -185,12 +185,12 @@ impl LitKind { impl Lit { /// Converts literal token into an AST literal. - crate fn from_lit_token(token: token::Lit, span: Span) -> Result { + pub fn from_lit_token(token: token::Lit, span: Span) -> Result { Ok(Lit { token, kind: LitKind::from_lit_token(token)?, span }) } /// Converts arbitrary token into an AST literal. - crate fn from_token(token: &Token) -> Result { + pub fn from_token(token: &Token) -> Result { let lit = match token.kind { token::Ident(name, false) if name.is_bool_lit() => token::Lit::new(token::Bool, name, None), @@ -217,8 +217,8 @@ impl Lit { Lit { token: kind.to_lit_token(), kind, span } } - /// Losslessly convert an AST literal into a token tree. - crate fn token_tree(&self) -> TokenTree { + /// Losslessly convert an AST literal into a token stream. + pub fn token_tree(&self) -> TokenTree { let token = match self.token.kind { token::Bool => token::Ident(self.token.symbol, false), _ => token::Literal(self.token), diff --git a/src/libsyntax/util/parser.rs b/src/libsyntax/util/parser.rs index edb708d7e97..df72fdc8014 100644 --- a/src/libsyntax/util/parser.rs +++ b/src/libsyntax/util/parser.rs @@ -69,7 +69,7 @@ pub enum Fixity { impl AssocOp { /// Creates a new AssocOP from a token - crate fn from_token(t: &Token) -> Option { + pub fn from_token(t: &Token) -> Option { use AssocOp::*; match t.kind { token::BinOpEq(k) => Some(AssignOp(k)), @@ -358,7 +358,7 @@ impl ExprPrecedence { } /// In `let p = e`, operators with precedence `<=` this one requires parenthesis in `e`. -crate fn prec_let_scrutinee_needs_par() -> usize { +pub fn prec_let_scrutinee_needs_par() -> usize { AssocOp::LAnd.precedence() } -- cgit 1.4.1-3-g733a5