Skip to content
This repository was archived by the owner on Jan 21, 2025. It is now read-only.

Commit a130c02

Browse files
stepanchegfacebook-github-bot
authored andcommitted
format_code_in_doc_comments = true
Summary: D52632085 Reviewed By: zertosh Differential Revision: D52639960 fbshipit-source-id: c659c45c7b1752b556ffce3d1ee65faed01b8e87
1 parent 1d03b4e commit a130c02

9 files changed

+0
-19
lines changed

cst_to_ast.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ pub struct RecoverableErrorLocation {
8787
/// Parser is responsible for driving parsing of a python code String into an internal CST representation
8888
/// before lowering to an AST. The AST is expected to match 1:1 with CPython. The AST is held within an
8989
/// `ASTAndMetaData` instance (and potentitally additional metadata)
90-
///
9190
#[derive(Debug)]
9291
pub struct Parser {
9392
code: String,
@@ -107,7 +106,6 @@ pub struct FilteredCSTParser<'a> {
107106

108107
///
109108
/// `ASTAndMetaData` presently just holds the lowered AST
110-
///
111109
#[derive(Debug)]
112110
pub struct ASTAndMetaData {
113111
// AST root for what was parsed correctly
@@ -253,7 +251,6 @@ impl Parser {
253251
/// Public entry point to parse code.
254252
/// Code is defined at construction time (`new`) but it could also be passed
255253
/// to this function. We could also pass a delta
256-
///
257254
pub fn parse(&mut self) -> Result<(), ParserError> {
258255
let mut cst_to_ast = SitterParser::new();
259256
cst_to_ast.set_language(tree_sitter_python::language())?;
@@ -305,7 +302,6 @@ impl Parser {
305302

306303
///
307304
/// Mark all error nodes from the Tree-sitter CST as SyntaxErrors
308-
///
309305
fn find_error_nodes(&mut self, node: TSNode) {
310306
if node.kind() == "ERROR" {
311307
let parser_error = RecoverableError::SyntaxError("invalid syntax".to_string());
@@ -5062,7 +5058,6 @@ impl<'parser> FilteredCSTParser<'parser> {
50625058
/// 6. We add escape characters again if needed (' -> \' or " -> \"). In practice,
50635059
/// this is relevant only when the the string contains both single (') and double
50645060
/// (") quotes.
5065-
///
50665061
fn process_string(&mut self, string_contents: String, node: &Node) -> ExprDesc {
50675062
// TODO: this method is getting quite unweildly, we should refactor it.
50685063
let mut string_contents = string_contents;
@@ -5327,7 +5322,6 @@ impl<'parser> FilteredCSTParser<'parser> {
53275322
/// Will return an identifier as a String and will record a
53285323
/// recoverable error if the identifier is invalid
53295324
/// (e.g. keyword, empty space etc)
5330-
///
53315325
fn get_valid_identifier(&mut self, node: &Node) -> String {
53325326
let identifier: String = self.get_text(node);
53335327
self.check_identifier_valid(&identifier, node);
@@ -5337,7 +5331,6 @@ impl<'parser> FilteredCSTParser<'parser> {
53375331
///
53385332
/// Will record a recoverable error if the identifier
53395333
/// is invalid (e.g. keyword, empty space etc)
5340-
///
53415334
fn check_identifier_valid(&mut self, identifier: &String, node: &Node) {
53425335
if self.python_keywords.contains(identifier) {
53435336
self.record_recoverable_error(

ffi_python.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ fn py_parse_module_print_ast_pretty_and_errors(
5858

5959
///
6060
/// run errpy but ignore result - useful for benchmarking
61-
///
6261
#[pyfunction]
6362
fn py_parse_module(input_code: String) -> PyResult<()> {
6463
let mut cst_to_ast = CSTToASTParser::new(input_code);

parser_post_process.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ impl ParserPostprocessor {
3535
/// * It begins with a letter or an underscore.
3636
/// * It is not followed by any punctuation.
3737
/// * It is not a reserved keyword.
38-
///
3938
fn valid_tokens_preceding_dot(&self, line: &str) -> bool {
4039
let preceding_tokens = match line.rsplit_once([' ', '.', ')', '\'', '}', ']', '\"']) {
4140
Some((_, identifier_and_trailing_dot)) => identifier_and_trailing_dot,
@@ -55,7 +54,6 @@ impl ParserPostprocessor {
5554
///
5655
/// Injects a `AUTOCOMPLETE_TOKEN` to the input code if a valid identifier
5756
/// followed by a trailing dot is found.
58-
///
5957
fn process_trailing_dots(&self, line: &str) -> String {
6058
let re = Regex::new(r"\.\s").expect("Invalid Regex");
6159
let mut result = Vec::new();

parser_pre_process.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ fn handle_quote_character(
7070
///
7171
/// For now this function is only used on in the context of AST production
7272
/// so it's fit for purpose.
73-
///
7473
pub fn remove_comments(input_code: String) -> String {
7574
use StringCommentState::*;
7675

printers.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ impl ParsingAndPrinter {
125125

126126
///
127127
/// Will return an empty string if there are no errors
128-
///
129128
fn extract_errors(metadata: &ASTAndMetaData) -> String {
130129
let mut errors = String::new();
131130
if !metadata.recoverable_errors.is_empty() {

printers/ast_pretty_print.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ fn format_vec_pattern(choices: &[Pattern], pprint_output: &mut PrintHelper) {
306306
///
307307
/// Function will format output without a trailing newline
308308
/// the caller is to add newline after the block if appropriate
309-
///
310309
fn format_block(body: &[Stmt], pprint_output: &mut PrintHelper) {
311310
pprint_output.inc_ident();
312311
for item in body.iter() {

printers/ast_print.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,6 @@ impl fmt::Display for Cmpop {
848848
/// Attempt to replicate PyOS_double_to_string function used by float_repr
849849
/// in floatobject.c for representing floats as strings
850850
/// https://github.com/python/cpython/blob/df81d2892eed3a256eb61ce59304f2173fb0c945/Python/pystrtod.c
851-
///
852851
pub fn cpython_float_to_string(value: &f64, is_complex: bool) -> String {
853852
if value.log10().ceil() >= 17. {
854853
// 17 digits or more requires exponent representation with + after the e

sitter.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use crate::node_wrapper::Node;
2323

2424
///
2525
/// Token supertype after extraction from Tree-sitter CST
26-
///
2726
#[derive(Debug)]
2827
pub enum NodeType<'a> {
2928
Error,
@@ -158,7 +157,6 @@ pub enum Delimiter {
158157
///
159158
/// A production is a node to traverse and it carries a
160159
/// reference to the sitter node
161-
///
162160
#[derive(Debug)]
163161
pub struct Production<'a> {
164162
pub production_kind: ProductionKind,
@@ -167,7 +165,6 @@ pub struct Production<'a> {
167165

168166
///
169167
/// Various forms of ProductionKind
170-
///
171168
#[derive(Debug, PartialEq)]
172169
#[allow(non_camel_case_types)]
173170
pub enum ProductionKind {
@@ -282,7 +279,6 @@ impl<'a> Production<'a> {
282279

283280
///
284281
/// Wrap a sitter `Node` into its structured wrapper (`NodeType`)
285-
///
286282
pub fn get_node_type<'a>(node: &'a Node<'a>) -> NodeType<'a> {
287283
match node.kind() {
288284
// keywords

tests/test_parser_post_process.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
///
77
/// Tests the process_trailing_dots method of the `parser_post_process` module.
8-
///
98
109
#[cfg(test)]
1110
mod process_trailing_dots_tests {

0 commit comments

Comments
 (0)