Skip to content

Commit

Permalink
register xp view command, fix more custombind parser issues, pull xp …
Browse files Browse the repository at this point in the history
…fixes
  • Loading branch information
AsianIntel committed Nov 6, 2024
1 parent 731e77f commit 593f304
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions rowifi/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,15 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
#[cfg(feature = "tower")]
{
use rowifi_tower::{
commands::{set_rank, xp_add, xp_remove, xp_set},
commands::{set_rank, xp_add, xp_remove, xp_set, xp_view},
init_tower,
};
router = router
.route("/setrank", post(set_rank))
.route("/xp/add", post(xp_add))
.route("/xp/remove", post(xp_remove))
.route("/xp/set", post(xp_set));
.route("/xp/set", post(xp_set))
.route("/xp/view", post(xp_view));
router = init_tower(router);
}

Expand Down
10 changes: 5 additions & 5 deletions rowifi_core/src/custombinds/parser.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use nom::{
branch::alt,
bytes::complete::tag,
character::complete::{alphanumeric1, anychar, char, digit1, multispace0, multispace1},
bytes::complete::{is_not, tag},
character::complete::{alphanumeric1, char, digit1, multispace0},
combinator::{all_consuming, map, map_res},
error::VerboseError,
multi::{many1, separated_list0},
Expand Down Expand Up @@ -66,7 +66,7 @@ fn parse_number(i: &str) -> IResult<&str, Atom, VerboseError<&str>> {
}

fn parse_string(i: &str) -> IResult<&str, Atom, VerboseError<&str>> {
map(delimited(char('"'), many1(anychar), char('"')), |s| {
map(delimited(char('"'), many1(is_not("\"")), char('"')), |s| {
Atom::String(s.into_iter().collect())
})
.parse(i)
Expand Down Expand Up @@ -140,7 +140,7 @@ fn parse_term(i: &str) -> IResult<&str, Expression, VerboseError<&str>> {

fn parse_negation(i: &str) -> IResult<&str, Expression, VerboseError<&str>> {
let (i, _) = tag("not")(i)?;
let (i, _) = multispace1(i)?;
let (i, _) = multispace0(i)?;
let (i, expr) = parse_expression(i)?;
Ok((
i,
Expand Down Expand Up @@ -337,7 +337,7 @@ mod tests {
#[test]
fn full_test_3() {
assert_eq!(
parser("(GetRank(1000) >= 200 and GetRank(1000) <= 253) and not (GetRank(2000) >= 10)"),
parser("(GetRank(1000) >= 200 and GetRank(1000) <= 253) and not(GetRank(2000) >= 10)"),
Ok(Expression::Operation(
Operator::And,
Box::new(Expression::Operation(
Expand Down

0 comments on commit 593f304

Please sign in to comment.