difftreelog
fix(rowan) unary plus
in: master
5 files changed
crates/jrsonnet-rowan-parser/jsonnet.ungramdiffbeforeafterboth131| 'ERROR_NO_OPERATOR!'131| 'ERROR_NO_OPERATOR!'132132133UnaryOperator =133UnaryOperator =134 '-' | '!' | '~'134 '-' | '!' | '~' | '+'135135136SliceDescEnd=Expr136SliceDescEnd=Expr137SliceDescStep=Expr137SliceDescStep=Exprcrates/jrsonnet-rowan-parser/src/generated/nodes.rsdiffbeforeafterboth977 Minus,977 Minus,978 Not,978 Not,979 BitNot,979 BitNot,980 Plus,980}981}981982982#[derive(Debug, Clone, PartialEq, Eq, Hash)]983#[derive(Debug, Clone, PartialEq, Eq, Hash)]2494impl UnaryOperatorKind {2495impl UnaryOperatorKind {2495 fn can_cast(kind: SyntaxKind) -> bool {2496 fn can_cast(kind: SyntaxKind) -> bool {2496 match kind {2497 match kind {2497 MINUS | NOT | BIT_NOT => true,2498 MINUS | NOT | BIT_NOT | PLUS => true,2498 _ => false,2499 _ => false,2499 }2500 }2500 }2501 }2503 MINUS => Self::Minus,2504 MINUS => Self::Minus,2504 NOT => Self::Not,2505 NOT => Self::Not,2505 BIT_NOT => Self::BitNot,2506 BIT_NOT => Self::BitNot,2507 PLUS => Self::Plus,2506 _ => return None,2508 _ => return None,2507 };2509 };2508 Some(res)2510 Some(res)crates/jrsonnet-rowan-parser/src/precedence.rsdiffbeforeafterboth22impl UnaryOperatorKind {22impl UnaryOperatorKind {23 pub fn binding_power(&self) -> ((), u8) {23 pub fn binding_power(&self) -> ((), u8) {24 match self {24 match self {25 Self::Minus | Self::Not | Self::BitNot => ((), 20),25 Self::Minus | Self::Not | Self::BitNot | Self::Plus => ((), 20),26 }26 }27 }27 }28}28}crates/jrsonnet-rowan-parser/src/snapshots/jrsonnet_rowan_parser__tests__no_lhs.snapdiffbeforeafterboth1---1---2source: crates/jrsonnet-rowan-parser/src/tests.rs2source: crates/jrsonnet-rowan-parser/src/tests.rs3assertion_line: 603expression: "+ 2\n"4expression: "* 2\n"4---5---5SOURCE_FILE@0..46SOURCE_FILE@0..46 EXPR@0..07 EXPR@0..07 ERROR_MISSING_TOKEN@0..08 ERROR_MISSING_TOKEN@0..08 ERROR_CUSTOM@0..39 ERROR_CUSTOM@0..39 PLUS@0..1 "+"10 MUL@0..1 "*"10 WHITESPACE@1..2 " "11 WHITESPACE@1..2 " "11 FLOAT@2..3 "2"12 FLOAT@2..3 "2"12 WHITESPACE@3..4 "\n"13 WHITESPACE@3..4 "\n"15LocatedSyntaxError { error: Custom { error: "unexpected tokens after end" }, range: 0..3 }16LocatedSyntaxError { error: Custom { error: "unexpected tokens after end" }, range: 0..3 }16===17===17 · ╭── missing expression18 · ╭── missing expression181 │ + 2191 │ * 219 · ╰───── unexpected tokens after end20 · ╰───── unexpected tokens after end2021crates/jrsonnet-rowan-parser/src/tests.rsdiffbeforeafterboth84 no_rhs => r#"84 no_rhs => r#"85 a +85 a +86 "#86 "#87 no_lhs => r#"87 no_lhs => r#"88 + 288 * 289 "#89 "#90 no_operator => "90 no_operator => "91 2 291 2 292 "92 "