Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releasing Logos2 #365

Merged
merged 9 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,32 @@ concurrency:
group: pages
cancel-in-progress: true

jobs:
jobs:
# Build job
build-book:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '0.4.28'
mdbook-version: 0.4.28

- name: Install mbBook-admonish
uses: taiki-e/install-action@v2
with:
tool: mdbook-admonish

- name: Download assets
run: |
cd book/
mdbook-admonish install

- name: Build book
run: mdbook build book

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/rustbench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:

name: Benchmark

permissions:
pull-requests: write
permissions:
pull-requests: write

jobs:
benchmark:
Expand All @@ -29,15 +29,15 @@ jobs:
version: latest

- name: Run Benchmarks on changes
run: cargo bench --bench bench -- --save-baseline changes
run: cargo bench --workspace --bench bench -- --save-baseline changes

- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
clean: false

- name: Run Benchmarks before changes
run: cargo bench --bench bench -- --save-baseline before
run: cargo bench --workspace --bench bench -- --save-baseline before

- name: Compare benchmarks
run: |
Expand Down
26 changes: 11 additions & 15 deletions .github/workflows/rustlib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,27 @@ jobs:
strategy:
matrix:
rust:
- stable
- beta
- nightly
- stable
- beta
- nightly
os:
- macos-latest
- ubuntu-latest
- windows-latest
- macos-latest
- ubuntu-latest
- windows-latest

runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache dependencies
uses: Swatinem/rust-cache@v2

- name: Check that code compiles
- name: Check that tests run
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose
command: test
args: --workspace --verbose
2 changes: 1 addition & 1 deletion .github/workflows/rustmsrv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
version: ^0.15.1

- name: Check MSRV
run: cd logos && cargo msrv verify -- cargo check --all-features
run: cargo msrv verify -- cargo check --workspace --all-features
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
hooks:
- id: pretty-format-yaml
args: [--autofix]
- id: pretty-format-toml
exclude: Cargo.lock
args: [--autofix, --trailing-commas]
- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
hooks:
- id: blackdoc
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies: [types-requests, types-setuptools]
82 changes: 79 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,82 @@
[workspace]
members = ["logos", "logos-cli", "logos-codegen", "logos-derive", "tests"]
members = ["logos-cli", "logos-codegen", "logos-derive", "tests"]
resolver = "2"

[workspace.package]
authors = ["Maciej Hirsz <[email protected]>", "Jérome Eertmans (maintainer) <[email protected]>"]
categories = ["parsing", "text-processing"]
description = "Create ridiculously fast Lexers"
edition = "2021"
homepage = "https://logos.maciej.codes/"
keywords = ["lexer", "lexical", "tokenizer", "parser", "no_std"]
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/maciejhirsz/logos"
rust-version = "1.65.0"
version = "0.13.0"

[package]
name = "logos2"
authors.workspace = true
categories.workspace = true
description.workspace = true
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
license.workspace = true
readme.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true

[package.metadata]
msrv = "1.65.0" # Needed to duplicate, because cargo-msrv does not support workspace

[lib]
bench = false
name = "logos"

[features]
default = ["export_derive", "std"]
# Re-exports the `Logos` derive macro, so that end user only needs to
# import this crate and `use logos::Logos` to get both the trait and
# derive proc macro.
export_derive = ["logos-derive2"]
# Should the crate use the standard library?
std = []

[package.metadata.docs.rs]
all-features = true
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.release]
shared-version = true
tag-name = "v{{version}}"

[profile]
release = { lto = true }
bench = { lto = true }
bench = {lto = true}
release = {lto = true}

[dependencies]
logos-derive2 = {version = "0.13.0", path = "./logos-derive", optional = true}

[dev-dependencies]
ariadne = {version = "0.2.0", features = ["auto-color"]}

[[example]]
doc-scrape-examples = true # Only needed once, because requires dev-dependencies
name = "brainfuck"
path = "examples/brainfuck.rs"

[[example]]
name = "custom_error"
path = "examples/custom_error.rs"

[[example]]
name = "extras"
path = "examples/extras.rs"

[[example]]
name = "json"
path = "examples/json.rs"
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
<img src="https://raw.githubusercontent.com/maciejhirsz/logos/master/logos.svg?sanitize=true" alt="Logos logo" width="250" align="right">

> [!WARNING]
> As of v0.14, Logos is released under `logos2`,
> see [#365](https://github.com/maciejhirsz/logos/pull/365). However, the library name
> is still `logos`, so you should only change your dependencies in `Cargo.toml` to
> use the latest versions.

# Logos

![Test](https://github.com/maciejhirsz/logos/workflows/Test/badge.svg?branch=master)
[![Crates.io version shield](https://img.shields.io/crates/v/logos.svg)](https://crates.io/crates/logos)
[![Docs](https://docs.rs/logos/badge.svg)](https://docs.rs/logos)
[![Crates.io license shield](https://img.shields.io/crates/l/logos.svg)](https://crates.io/crates/logos)
[![Crates.io version shield](https://img.shields.io/crates/v/logos.svg)](https://crates.io/crates/logos2)
[![Docs](https://docs.rs/logos2/badge.svg)](https://docs.rs/logos2)
[![Crates.io license shield](https://img.shields.io/crates/l/logos.svg)](https://crates.io/crates/logos2)

_Create ridiculously fast Lexers._

Expand Down Expand Up @@ -71,7 +77,7 @@ To achieve those, **Logos**:

For more examples and documentation, please refer to the
[Logos handbook](https://maciejhirsz.github.io/logos/) or the
[crate documentation](https://docs.rs/logos/latest/logos/).
[crate documentation](https://docs.rs/logos2/latest/logos/).

## How fast?

Expand Down
11 changes: 10 additions & 1 deletion book/book.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
[book]
authors = ["Maciej Hirsz"]
authors = ["Maciej Hirsz <[email protected]>", "Jérome Eertmans (maintainer) <[email protected]>"]
language = "en"
multilingual = false
src = "src"
title = "Logos Handbook"

[preprocessor.admonish]
command = "mdbook-admonish"
assets_version = "3.0.2" # do not edit: managed by `mdbook-admonish install`

[output]

[output.html]
additional-css = ["./mdbook-admonish.css"]
Loading
Loading