GithubHelp home page GithubHelp logo

combi's Introduction

Combi

Combi is a parsec-inspired Rust parser combinator library. It can parse any type implementing Stream trait, and has built-in implementations for &str and &[u8].

Features

  • Built in error-handling

Example programs

JSON Parser

Usage:

cargo run --example json <FILE> [..keys]

The file can also be received from piping:

cargo run --example json [..keys] < <FILE> or <program> | cargo run --example json [..keys]

Example:

$ echo '{"a": {"c": 2}, "b": [2,3] }' | cargo run --example json a
{
  "c": 2
}

$ echo '{"a": {"c": 2}, "b": [2,3] }' | cargo run --example json a c
2

$ echo '{"a": {"c": 2}, "b": [2,3] }' | cargo run --example json b 1
3

RegEx Engine

Usage:

cargo run --example regex <FILE> <PATTERN>

The file can also be received from piping:

cargo run --example regex <PATTERN> < <FILE> or <program> | cargo run --example regex <PATTERN>

Example:

""

$ echo "foobar\nbaz\nfoo" | cargo run --example regex 'foo'
foobar
foo

$ cargo run --example regex '[a-zA-Z0-9._%-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,4}' <<EOF
[email protected]
invalidEmail.com
[email protected]
invalidmail_2&@a.com
invalidmail_3@com
VAL%[email protected]
EOF
[email protected]
[email protected]
VAL%[email protected]

TODO

  • Add a difference between Errors that consume input vs those that don't
  • Error message prettifier
  • Indentation parsers
  • Add more example programs
  • Add ability to add custom errors
  • Add unit tests
  • Documentation
  • Optimization

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.