| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e800af7 commit 21afc19
35 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,121 +26,171 @@ | |||
| 26 | 26 | "words": [ | |
| 27 | 27 | // Rust | |
| 28 | 28 | "ahash", | |
| 29 | - "bitflags", | ||
| 30 | 29 | "bindgen", | |
| 31 | - "cstring", | ||
| 30 | + "bitflags", | ||
| 32 | 31 | "chrono", | |
| 32 | + "cstring", | ||
| 33 | 33 | "flate2", | |
| 34 | + "hasher", | ||
| 35 | + "indexmap", | ||
| 34 | 36 | "insta", | |
| 35 | - "peekable", | ||
| 37 | + "keccak", | ||
| 36 | 38 | "lalrpop", | |
| 37 | - "memmap", | ||
| 38 | 39 | "Manually", | |
| 40 | + "memmap", | ||
| 41 | + "peekable", | ||
| 42 | + "prepended", | ||
| 39 | 43 | "rustc", | |
| 44 | + "rustfmt", | ||
| 40 | 45 | "splitn", | |
| 41 | - "unistd", | ||
| 42 | 46 | "unic", | |
| 47 | + "unistd", | ||
| 43 | 48 | // Python | |
| 49 | + "abstractmethods", | ||
| 50 | + "aiter", | ||
| 51 | + "anext", | ||
| 52 | + "basicsize", | ||
| 44 | 53 | "cformat", | |
| 54 | + "classcell", | ||
| 45 | 55 | "cpython", | |
| 46 | - "fspath", | ||
| 47 | - "kwarg", | ||
| 48 | - "kwargs", | ||
| 49 | - "vararg", | ||
| 50 | - "varargs", | ||
| 51 | - "metaclass", | ||
| 52 | - "metaclasses", | ||
| 53 | - "fstring", | ||
| 54 | - "fstrings", | ||
| 56 | + "defaultaction", | ||
| 57 | + "descr", | ||
| 58 | + "dictcomp", | ||
| 55 | 59 | "docstring", | |
| 56 | 60 | "docstrings", | |
| 61 | + "dunder", | ||
| 62 | + "eventmask", | ||
| 63 | + "fdel", | ||
| 57 | 64 | "fileencoding", | |
| 65 | + "finallyhandler", | ||
| 66 | + "fspath", | ||
| 67 | + "fstring", | ||
| 68 | + "fstrings", | ||
| 69 | + "genexpr", | ||
| 70 | + "getattro", | ||
| 71 | + "getweakrefcount", | ||
| 72 | + "getweakrefs", | ||
| 73 | + "idiv", | ||
| 74 | + "impls", | ||
| 75 | + "instanceof", | ||
| 76 | + "itemsize", | ||
| 77 | + "iternext", | ||
| 78 | + "kwarg", | ||
| 79 | + "kwargs", | ||
| 58 | 80 | "linearization", | |
| 59 | 81 | "linearize", | |
| 82 | + "listcomp", | ||
| 83 | + "mappingproxy", | ||
| 84 | + "maxsplit", | ||
| 85 | + "MemoryView", | ||
| 86 | + "metaclass", | ||
| 87 | + "metaclasses", | ||
| 88 | + "metatype", | ||
| 89 | + "ndim", | ||
| 90 | + "nonbytes", | ||
| 91 | + "origname", | ||
| 60 | 92 | "PYTHONDEBUG", | |
| 93 | + "PYTHONHOME", | ||
| 61 | 94 | "PYTHONINSPECT", | |
| 95 | + "PYTHONOPTIMIZE", | ||
| 62 | 96 | "PYTHONPATH", | |
| 63 | - "PYTHONHOME", | ||
| 64 | 97 | "PYTHONPATH", | |
| 65 | 98 | "PYTHONVERBOSE", | |
| 66 | - "PYTHONOPTIMIZE", | ||
| 67 | 99 | "PYTHONWARNINGS", | |
| 68 | - "basicsize", | ||
| 69 | - "itemsize", | ||
| 70 | - "origname", | ||
| 71 | - "getattro", | ||
| 72 | - "setattro", | ||
| 73 | - "iternext", | ||
| 74 | - "maxsplit", | ||
| 75 | - "fdel", | ||
| 76 | - "subclasscheck", | ||
| 77 | 100 | "qualname", | |
| 78 | - "eventmask", | ||
| 79 | - "instanceof", | ||
| 80 | - "abstractmethods", | ||
| 81 | - "aiter", | ||
| 82 | - "anext", | ||
| 83 | 101 | "rdiv", | |
| 84 | - "idiv", | ||
| 85 | - "ndim", | ||
| 102 | + "setattro", | ||
| 103 | + "setcomp", | ||
| 104 | + "stacklevel", | ||
| 105 | + "subclasscheck", | ||
| 86 | 106 | "unionable", | |
| 107 | + "unraisablehook", | ||
| 108 | + "vararg", | ||
| 109 | + "varargs", | ||
| 87 | 110 | "varnames", | |
| 88 | - "getweakrefs", | ||
| 89 | - "getweakrefcount", | ||
| 90 | - "stacklevel", | ||
| 91 | - "MemoryView", | ||
| 92 | - "metatype", | ||
| 93 | 111 | "warningregistry", | |
| 94 | - "defaultaction", | ||
| 95 | - "unraisablehook", | ||
| 96 | - "descr", | ||
| 97 | - "xopts", | ||
| 98 | 112 | "warnopts", | |
| 99 | 113 | "weakproxy", | |
| 100 | - "mappingproxy", | ||
| 114 | + "xopts", | ||
| 101 | 115 | // RustPython | |
| 102 | - "RustPython", | ||
| 116 | + "Bytecode", | ||
| 117 | + "codegen", | ||
| 118 | + "dedentations", | ||
| 119 | + "dedents", | ||
| 120 | + "deduped", | ||
| 121 | + "dumpable", | ||
| 122 | + "GetSet", | ||
| 123 | + "makeunicodedata", | ||
| 124 | + "miri", | ||
| 125 | + "pyarg", | ||
| 103 | 126 | "pyarg", | |
| 104 | 127 | "pyargs", | |
| 105 | - "pygetset", | ||
| 106 | - "pyobj", | ||
| 107 | - "pystr", | ||
| 128 | + "PyAttr", | ||
| 108 | 129 | "pyc", | |
| 109 | - "pyref", | ||
| 110 | - "pyslot", | ||
| 111 | - "PyFunction", | ||
| 112 | - "PyMethod", | ||
| 113 | - "PyClassMethod", | ||
| 114 | - "PyStaticMethod", | ||
| 115 | - "PyProperty", | ||
| 116 | 130 | "PyClass", | |
| 131 | + "PyClassMethod", | ||
| 132 | + "PyException", | ||
| 133 | + "PyFunction", | ||
| 134 | + "pygetset", | ||
| 117 | 135 | "pyimpl", | |
| 118 | - "pyarg", | ||
| 136 | + "PyMethod", | ||
| 119 | 137 | "PyModule", | |
| 120 | - "PyAttr", | ||
| 121 | - "PyResult", | ||
| 138 | + "pyobj", | ||
| 122 | 139 | "PyObject", | |
| 123 | - "PyException", | ||
| 124 | - "GetSet", | ||
| 125 | - "zelf", | ||
| 126 | - "wasi", | ||
| 127 | - "Bytecode", | ||
| 140 | + "PyProperty", | ||
| 141 | + "pyref", | ||
| 142 | + "PyResult", | ||
| 143 | + "pyslot", | ||
| 144 | + "PyStaticMethod", | ||
| 145 | + "pystr", | ||
| 128 | 146 | "richcompare", | |
| 129 | - "makeunicodedata", | ||
| 130 | - "unhashable", | ||
| 131 | - "unraisable", | ||
| 147 | + "RustPython", | ||
| 148 | + "tracebacks", | ||
| 132 | 149 | "typealiases", | |
| 133 | 150 | "Unconstructible", | |
| 134 | - "posonlyargs", | ||
| 135 | - "kwonlyargs", | ||
| 151 | + "unhashable", | ||
| 136 | 152 | "uninit", | |
| 137 | - "miri", | ||
| 138 | - "tracebacks", | ||
| 153 | + "unraisable", | ||
| 154 | + "wasi", | ||
| 155 | + "zelf", | ||
| 139 | 156 | // cpython | |
| 140 | - "linearise", | ||
| 157 | + "argtypes", | ||
| 158 | + "asdl", | ||
| 159 | + "asname", | ||
| 160 | + "augassign", | ||
| 161 | + "boolop", | ||
| 162 | + "bxor", | ||
| 163 | + "cellarg", | ||
| 164 | + "cellvar", | ||
| 165 | + "cellvars", | ||
| 166 | + "cmpop", | ||
| 141 | 167 | "dictoffset", | |
| 168 | + "elts", | ||
| 169 | + "excepthandler", | ||
| 170 | + "finalbody", | ||
| 171 | + "freevar", | ||
| 172 | + "freevars", | ||
| 173 | + "fromlist", | ||
| 142 | 174 | "heaptype", | |
| 143 | - "IMMUTABLETYPE" | ||
| 175 | + "IMMUTABLETYPE", | ||
| 176 | + "kwonlyarg", | ||
| 177 | + "kwonlyargs", | ||
| 178 | + "linearise", | ||
| 179 | + "maxdepth", | ||
| 180 | + "mult", | ||
| 181 | + "nkwargs", | ||
| 182 | + "orelse", | ||
| 183 | + "patma", | ||
| 184 | + "posonlyarg", | ||
| 185 | + "posonlyargs", | ||
| 186 | + "prec", | ||
| 187 | + "stackdepth", | ||
| 188 | + "unaryop", | ||
| 189 | + "unparse", | ||
| 190 | + "unparser", | ||
| 191 | + "VARKEYWORDS", | ||
| 192 | + "varkwarg", | ||
| 193 | + "withitem" | ||
| 144 | 194 | ], | |
| 145 | 195 | // flagWords - list of words to be always considered incorrect | |
| 146 | 196 | "flagWords": [ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,10 +48,10 @@ impl<'a> Unparser<'a> { | |||
| 48 | 48 | } | |
| 49 | 49 | ||
| 50 | 50 | fn unparse_expr<U>(&mut self, ast: &Expr<U>, level: u8) -> fmt::Result { | |
| 51 | - macro_rules! opprec { | ||
| 52 | - ($opty:ident, $x:expr, $enu:path, $($var:ident($op:literal, $prec:ident)),*$(,)?) => { | ||
| 51 | + macro_rules! op_prec { | ||
| 52 | + ($op_ty:ident, $x:expr, $enu:path, $($var:ident($op:literal, $prec:ident)),*$(,)?) => { | ||
| 53 | 53 | match $x { | |
| 54 | - $(<$enu>::$var => (opprec!(@space $opty, $op), precedence::$prec),)* | ||
| 54 | + $(<$enu>::$var => (op_prec!(@space $op_ty, $op), precedence::$prec),)* | ||
| 55 | 55 | } | |
| 56 | 56 | }; | |
| 57 | 57 | (@space bin, $op:literal) => { | |
@@ -72,7 +72,7 @@ impl<'a> Unparser<'a> { | |||
| 72 | 72 | } | |
| 73 | 73 | match &ast.node { | |
| 74 | 74 | ExprKind::BoolOp { op, values } => { | |
| 75 | - let (op, prec) = opprec!(bin, op, Boolop, And("and", AND), Or("or", OR)); | ||
| 75 | + let (op, prec) = op_prec!(bin, op, Boolop, And("and", AND), Or("or", OR)); | ||
| 76 | 76 | group_if!(prec, { | |
| 77 | 77 | let mut first = true; | |
| 78 | 78 | for val in values { | |
@@ -89,8 +89,8 @@ impl<'a> Unparser<'a> { | |||
| 89 | 89 | }) | |
| 90 | 90 | } | |
| 91 | 91 | ExprKind::BinOp { left, op, right } => { | |
| 92 | - let rassoc = matches!(op, Operator::Pow); | ||
| 93 | - let (op, prec) = opprec!( | ||
| 92 | + let right_associative = matches!(op, Operator::Pow); | ||
| 93 | + let (op, prec) = op_prec!( | ||
| 94 | 94 | bin, | |
| 95 | 95 | op, | |
| 96 | 96 | Operator, | |
@@ -109,13 +109,13 @@ impl<'a> Unparser<'a> { | |||
| 109 | 109 | FloorDiv("//", TERM), | |
| 110 | 110 | ); | |
| 111 | 111 | group_if!(prec, { | |
| 112 | - self.unparse_expr(left, prec + rassoc as u8)?; | ||
| 112 | + self.unparse_expr(left, prec + right_associative as u8)?; | ||
| 113 | 113 | self.p(op)?; | |
| 114 | - self.unparse_expr(right, prec + !rassoc as u8)?; | ||
| 114 | + self.unparse_expr(right, prec + !right_associative as u8)?; | ||
| 115 | 115 | }) | |
| 116 | 116 | } | |
| 117 | 117 | ExprKind::UnaryOp { op, operand } => { | |
| 118 | - let (op, prec) = opprec!( | ||
| 118 | + let (op, prec) = op_prec!( | ||
| 119 | 119 | un, | |
| 120 | 120 | op, | |
| 121 | 121 | crate::Unaryop, | |
@@ -131,8 +131,8 @@ impl<'a> Unparser<'a> { | |||
| 131 | 131 | } | |
| 132 | 132 | ExprKind::Lambda { args, body } => { | |
| 133 | 133 | group_if!(precedence::TEST, { | |
| 134 | - let npos = args.args.len() + args.posonlyargs.len(); | ||
| 135 | - self.p(if npos > 0 { "lambda " } else { "lambda" })?; | ||
| 134 | + let pos = args.args.len() + args.posonlyargs.len(); | ||
| 135 | + self.p(if pos > 0 { "lambda " } else { "lambda" })?; | ||
| 136 | 136 | self.unparse_args(args)?; | |
| 137 | 137 | write!(self, ": {}", **body)?; | |
| 138 | 138 | }) | |
@@ -260,7 +260,7 @@ impl<'a> Unparser<'a> { | |||
| 260 | 260 | [], | |
| 261 | 261 | ) = (&**args, &**keywords) | |
| 262 | 262 | { | |
| 263 | - // make sure a single genexp doesn't get double parens | ||
| 263 | + // make sure a single genexpr doesn't get double parens | ||
| 264 | 264 | self.unparse_expr(elt, precedence::TEST)?; | |
| 265 | 265 | self.unparse_comp(generators)?; | |
| 266 | 266 | } else { | |
@@ -287,7 +287,7 @@ impl<'a> Unparser<'a> { | |||
| 287 | 287 | conversion, | |
| 288 | 288 | format_spec, | |
| 289 | 289 | } => self.unparse_formatted(value, *conversion, format_spec.as_deref())?, | |
| 290 | - ExprKind::JoinedStr { values } => self.unparse_joinedstr(values, false)?, | ||
| 290 | + ExprKind::JoinedStr { values } => self.unparse_joined_str(values, false)?, | ||
| 291 | 291 | ExprKind::Constant { value, kind } => { | |
| 292 | 292 | if let Some(kind) = kind { | |
| 293 | 293 | self.p(kind)?; | |
@@ -490,7 +490,7 @@ impl<'a> Unparser<'a> { | |||
| 490 | 490 | unreachable!() | |
| 491 | 491 | } | |
| 492 | 492 | } | |
| 493 | - ExprKind::JoinedStr { values } => self.unparse_joinedstr(values, is_spec), | ||
| 493 | + ExprKind::JoinedStr { values } => self.unparse_joined_str(values, is_spec), | ||
| 494 | 494 | ExprKind::FormattedValue { | |
| 495 | 495 | value, | |
| 496 | 496 | conversion, | |
@@ -505,7 +505,7 @@ impl<'a> Unparser<'a> { | |||
| 505 | 505 | self.p(&s) | |
| 506 | 506 | } | |
| 507 | 507 | ||
| 508 | - fn unparse_joinedstr<U>(&mut self, values: &[Expr<U>], is_spec: bool) -> fmt::Result { | ||
| 508 | + fn unparse_joined_str<U>(&mut self, values: &[Expr<U>], is_spec: bool) -> fmt::Result { | ||
| 509 | 509 | if is_spec { | |
| 510 | 510 | self.unparse_fstring_body(values, is_spec) | |
| 511 | 511 | } else { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments