Skip to content

Commit

Permalink
Rename Or to BitOr despite it also being type Or for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Cypher1 committed Sep 29, 2024
1 parent 61da82e commit 4c4cca5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions takolib/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ fn main() {
ctp.yacckind(YaccKind::Grmtools)
.grammar_in_src_dir("tako.y")
.expect("tako.y failed to build")
.show_warnings(true)
.warnings_are_errors(true)
.error_on_conflicts(true)
})
.lexer_in_src_dir("tako.l")
.expect("tako.l failed to build")
Expand Down
4 changes: 2 additions & 2 deletions takolib/src/tako.l
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ write "write"
/= "DivAssign"
\*= "MulAssign"
&= "AndAssign"
|= "OrAssign"
|= "BitOrAssign"
^= "BitXorAssign"
&&= "LogicalAndAssign"
||= "LogicalOrAssign"
Expand Down Expand Up @@ -114,7 +114,7 @@ write "write"
\? "Try"
@ "GetAddress"
^ "BitXor"
\| "Or"
\| "BitOr"
\|> "RightPipe"
\|\| "LogicalOr"
~ "BitNot"
Expand Down
16 changes: 8 additions & 8 deletions takolib/src/tako.y
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ RightShiftArg -> R: SimpleExpr { $1 };

AddArg -> R: Mul { $1 };
MulArg -> R: Exp { $1 };
ExpArg -> R: Or { $1 } | LogicalOr { $1 } | BitXor { $1 } | Modulo { $1 };
OrArg -> R: And { $1 };
ExpArg -> R: BitOr { $1 } | LogicalOr { $1 } | BitXor { $1 } | Modulo { $1 };
BitOrArg -> R: And { $1 };
AndArg -> R: SimpleExpr { $1 };
LogicalOrArg -> R: LogicalAnd { $1 };
TryArg -> R: Range { $1 };
Expand Down Expand Up @@ -200,10 +200,10 @@ Assign -> R:
// TODO: Flatten
Ok(op)
}
| AssignTarget 'OrAssign' AssignArg
| AssignTarget 'BitOrAssign' AssignArg
{
let op = with(ctx).add_op(Op{
op: Symbol::OrAssign,
op: Symbol::BitOrAssign,
args: smallvec![$1?, $3?]
},
$span.into()
Expand Down Expand Up @@ -463,17 +463,17 @@ Range -> R:
}
| RangeArg { $1 };

Or -> R:
Or 'Or' OrArg {
BitOr -> R:
BitOr 'BitOr' BitOrArg {
let op = with(ctx).add_op(Op{
op: Symbol::Or,
op: Symbol::BitOr,
args: smallvec![$1?, $3?]
},
$span.into()
);
Ok(op)
}
| OrArg { $1 };
| BitOrArg { $1 };

LogicalOr -> R:
LogicalOr 'LogicalOr' LogicalOrArg {
Expand Down

0 comments on commit 4c4cca5

Please sign in to comment.