-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
393 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
name: CI | ||
on: [ workflow_dispatch, push, pull_request ] | ||
jobs: | ||
omnilint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4.1.1 | ||
- uses: docker://lpenz/omnilint:0.5.1 | ||
rust: | ||
uses: lpenz/ghworkflow-rust/.github/workflows/rust.yml@v0.18.0 | ||
with: | ||
coveralls: true | ||
publish_cratesio: false | ||
publish_github_release: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[workspace] | ||
members = [ | ||
"aoc", | ||
"day00-template", | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,19 @@ | ||
![AoC](https://img.shields.io/badge/AoC%20%E2%AD%90-0-yellow) | ||
[![CI](https://github.com/lpenz/adventofcode2023/workflows/CI/badge.svg)](https://github.com/lpenz/adventofcode2023/actions) | ||
[![coveralls](https://coveralls.io/repos/github/lpenz/adventofcode2023/badge.svg?branch=main)](https://coveralls.io/github/lpenz/adventofcode2023?branch=main) | ||
|
||
# adventofcode2023 | ||
Code for the 2022 puzzles at https://adventofcode.com/2023/ | ||
|
||
Code for the 2023 puzzles at https://adventofcode.com/2023/ | ||
|
||
|
||
## Noteworthy days (spoiler alert!) | ||
|
||
Some interesting things that happened on specific days: | ||
|
||
|
||
|
||
<table><tr> | ||
<td><a href="https://github.com/lpenz/adventofcode2022">:arrow_left: 2022</td> | ||
</tr></table> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "aoc" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
color-eyre = "0.6.2" | ||
nom = "7.1.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#[macro_use] | ||
pub mod parser { | ||
pub use color_eyre::eyre::eyre; | ||
pub use color_eyre::Result; | ||
pub use nom::branch; | ||
pub use nom::bytes::complete as bytes; | ||
pub use nom::character::complete as character; | ||
pub use nom::combinator; | ||
pub use nom::multi; | ||
pub use nom::Finish; | ||
pub use nom::IResult; | ||
pub use std::io::BufRead; | ||
|
||
#[macro_export] | ||
macro_rules! parse_with { | ||
($parser:expr, $buf:ident) => {{ | ||
let mut input = String::default(); | ||
$buf.read_to_string(&mut input)?; | ||
let result = combinator::all_consuming($parser)(&input).finish(); | ||
Ok(result.map_err(|e| eyre!("error reading input: {:?}", e))?.1) | ||
}}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "day00" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
aoc = { path = "../aoc" } | ||
color-eyre = "0.6.2" | ||
nom = "7.1.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (C) 2023 Leandro Lisboa Penz <lpenz@lpenz.org> | ||
// This file is subject to the terms and conditions defined in | ||
// file 'LICENSE', which is part of this source code package. | ||
|
||
use std::io::{stdin, BufRead}; | ||
|
||
use day00::*; | ||
|
||
fn process(bufin: impl BufRead) -> Result<usize> { | ||
let input = parser::parse(bufin)?; | ||
Ok(input.len()) | ||
} | ||
|
||
#[test] | ||
fn test() -> Result<()> { | ||
assert_eq!(process(EXAMPLE.as_bytes())?, 1); | ||
Ok(()) | ||
} | ||
|
||
fn main() -> Result<()> { | ||
color_eyre::install()?; | ||
println!("{}", process(stdin().lock())?); | ||
Ok(()) | ||
} |
Oops, something went wrong.