An IRC (RFC1459) parser and formatter, built in Rust.

Related tags

Parsing ircparser
Overview

ircparser

An IRC (RFC1459) parser and formatter, built in Rust.

ircparser should work on basically any Rust version, but the earliest version checked in the CI is v1.31 (the first version with Rust 2018 support).

Setup

To use the latest stable version of ircparser, add it to your Cargo.toml file like so:

[dependencies]
ircparser = "^0.2.1"

You can also use the latest development version by specifying the following:

[dependencies]
ircparser = { git = "https://github.com/parafoxia/ircparser" }

Usage

ircparser currently only has one public function — parse. This function takes a line of an IRC message, and parses it into an easy-to-use Line object.

use ircparser;

fn main() {
    let msg = "@id=123;name=rick :[email protected] PRIVMSG #rickastley :Never gonna give you up!";
    match ircparser::parse(msg) {
        Ok(x) => {
            let line = x;

            assert_eq!(&line.tags["id"], "123");
            if line.source.is_some() {
                assert_eq!(line.source.unwrap(), ":[email protected]");
            }
            assert_eq!(line.command, "PRIVMSG");
            assert_eq!(line.params[0], "#rickastley");
            assert_eq!(line.params[1], "Never gonna give you up!");
        }
        Err(e) => {
            println!("A parsing error occured: {e}");
            return;
        }
    };
}

License

The ircparser crate for Rust is licensed under the BSD 3-Clause License.

You might also like...
Parser for Object files define the geometry and other properties for objects in Wavefront's Advanced Visualizer.

format of the Rust library load locad blender obj file to Rust NDArray. cargo run test\t10k-images.idx3-ubyte A png file will be generated for the fi

Lexer and parser collections.

laps Lexer and parser collections. With laps, you can build parsers by just defining ASTs and deriving Parse trait for them. Usage Add laps to your pr

Rust parser combinator framework

nom, eating data byte by byte nom is a parser combinators library written in Rust. Its goal is to provide tools to build safe parsers without compromi

Parsing Expression Grammar (PEG) parser generator for Rust

Parsing Expression Grammars in Rust Documentation | Release Notes rust-peg is a simple yet flexible parser generator that makes it easy to write robus

A fast monadic-style parser combinator designed to work on stable Rust.

Chomp Chomp is a fast monadic-style parser combinator library designed to work on stable Rust. It was written as the culmination of the experiments de

A parser combinator library for Rust

combine An implementation of parser combinators for Rust, inspired by the Haskell library Parsec. As in Parsec the parsers are LL(1) by default but th

LR(1) parser generator for Rust

LALRPOP LALRPOP is a Rust parser generator framework with usability as its primary goal. You should be able to write compact, DRY, readable grammars.

A typed parser generator embedded in Rust code for Parsing Expression Grammars

Oak Compiled on the nightly channel of Rust. Use rustup for managing compiler channels. You can download and set up the exact same version of the comp

Rust query string parser with nesting support

What is Queryst? This is a fork of the original, with serde and serde_json updated to 0.9 A query string parsing library for Rust inspired by https://

Releases(v0.2.1)
  • v0.2.1(Aug 2, 2022)

  • v0.2.0(Aug 2, 2022)

    Changes

    • The parse function can now accept messages of multiple lines

    Breaking changes

    • A consequence of the above change is that the parse function now returns a VecDeque<Line> rather than a Line
    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Jul 30, 2022)

Owner
Ethan Henderson
Studying MSc Computer Science at the University of Lincoln. Holder of a First-Class Honours degree. Founder of Carberra Tutorials.
Ethan Henderson
Website for Microformats Rust parser (using 'microformats-parser'/'mf2')

Website for Microformats Rust parser (using 'microformats-parser'/'mf2')

Microformats 5 Jul 19, 2022
Pure, simple and elegant HTML parser and editor.

HTML Editor Pure, simple and elegant HTML parser and editor. Examples Parse HTML segment/document let document = parse("<!doctype html><html><head></h

Lomirus 16 Nov 8, 2022
A native Rust port of Google's robots.txt parser and matcher C++ library.

robotstxt A native Rust port of Google's robots.txt parser and matcher C++ library. Native Rust port, no third-part crate dependency Zero unsafe code

Folyd 72 Dec 11, 2022
🕑 A personal git log and MacJournal output parser, written in rust.

?? git log and MacJournal export parser A personal project, written in rust. WORK IN PROGRESS; NOT READY This repo consolidates daily activity from tw

Steven Black 4 Aug 17, 2022
Sqllogictest parser and runner in Rust.

Sqllogictest-rs Sqllogictest parser and runner in Rust. License Licensed under either of Apache License, Version 2.0 (LICENSE-APACHE or http://www.apa

Singularity Data Inc. 101 Dec 21, 2022
A CSS parser, transformer, and minifier written in Rust.

@parcel/css A CSS parser, transformer, and minifier written in Rust. Features Extremely fast – Parsing and minifying large files is completed in milli

Parcel 3.1k Jan 9, 2023
A WIP svelte parser written in rust. Designed with error recovery and reporting in mind

Svelte(rs) A WIP parser for svelte files that is designed with error recovery and reporting in mind. This is mostly a toy project for now, with some v

James Birtles 3 Apr 19, 2023
A rusty, dual-wielding Quake and Half-Life texture WAD parser.

Ogre   A rusty, dual-wielding Quake and Half-Life texture WAD parser ogre is a rust representation and nom parser for Quake and Half-Life WAD files. I

Josh Palmer 16 Dec 5, 2022
A modern dialogue executor and tree parser using YAML.

A modern dialogue executor and tree parser using YAML. This crate is for building(ex), importing/exporting(ex), and walking(ex) dialogue trees. convo

Spencer Imbleau 27 Aug 3, 2022
Org mode structural parser/emitter with an emphasis on modularity and avoiding edits unrelated to changes.

Introduction Org mode structural parser/emitter with an emphasis on modularity and avoiding edits unrelated to changes. The goal of this library is to

Alex Roper 4 Oct 7, 2022