Skip to content
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
12 changes: 6 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ jobs:
- name: Publish to Crates.io (with version check)
id: publish-crate
run: |
PACKAGE_NAME=$(grep '^name = ' Cargo.toml | head -1 | sed 's/name = "\(.*\)"/\1/')
PACKAGE_VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
PACKAGE_NAME=$(grep '^name = ' links-notation/Cargo.toml | head -1 | sed 's/name = "\(.*\)"/\1/')
PACKAGE_VERSION=$(grep '^version = ' links-notation/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
echo "Package: $PACKAGE_NAME@$PACKAGE_VERSION"

echo "=== Attempting to publish to crates.io ==="

# Try to publish and capture the result
set +e # Don't exit on error
cargo publish --token ${{ secrets.CARGO_TOKEN }} --allow-dirty 2>&1 | tee publish_output.txt
cargo publish -p links-notation --token ${{ secrets.CARGO_TOKEN }} --allow-dirty 2>&1 | tee publish_output.txt
PUBLISH_EXIT_CODE=$?
set -e # Re-enable exit on error

Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
- name: Check if GitHub release already exists
id: release-check
run: |
PACKAGE_VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
PACKAGE_VERSION=$(grep '^version = ' links-notation/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
TAG_NAME="rust_$PACKAGE_VERSION"
echo "Checking if release $TAG_NAME already exists"

Expand All @@ -204,8 +204,8 @@ jobs:
- name: Create GitHub release
if: steps.release-check.outputs.should_create_release == 'true'
run: |
PACKAGE_NAME=$(grep '^name = ' Cargo.toml | head -1 | sed 's/name = "\(.*\)"/\1/')
PACKAGE_VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
PACKAGE_NAME=$(grep '^name = ' links-notation/Cargo.toml | head -1 | sed 's/name = "\(.*\)"/\1/')
PACKAGE_VERSION=$(grep '^version = ' links-notation/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')

# Create release with consistent tag format: rust_version
gh release create "rust_${PACKAGE_VERSION}" \
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ ASALocalRun/

# rust
rust/target/
rust/**/target/
rust/**/Cargo.lock
target/venv/
.venv/
venv/
Expand Down
26 changes: 26 additions & 0 deletions experiments/test_macro_output.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use links_notation::{lino, parse_lino};

fn main() {
// Test simple input
let result1 = lino!("papa (lovesMama: loves mama)");
println!("Macro result for 'papa (lovesMama: loves mama)':");
println!("{:#?}", result1);
println!();

// Compare with runtime parse
let result2 = parse_lino("papa (lovesMama: loves mama)").unwrap();
println!("Runtime parse result:");
println!("{:#?}", result2);
println!();

// Test triplet
let result3 = lino!("papa has car");
println!("Macro result for 'papa has car':");
println!("{:#?}", result3);
println!();

// Test nested
let result4 = lino!("(outer (inner value))");
println!("Macro result for '(outer (inner value))':");
println!("{:#?}", result4);
}
20 changes: 20 additions & 0 deletions experiments/test_specific_cases.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use links_notation::{lino, parse_lino};

fn main() {
// Test simple
let result1 = lino!("simple");
println!("Macro result for 'simple':");
println!("{:#?}", result1);
println!();

// Test parenthesized
let result2 = lino!("(parent: child1 child2)");
println!("Macro result for '(parent: child1 child2)':");
println!("{:#?}", result2);
println!();

// Test quoted
let result3 = lino!(r#"("quoted id": "quoted value")"#);
println!("Macro result for '(\"quoted id\": \"quoted value\")':");
println!("{:#?}", result3);
}
25 changes: 0 additions & 25 deletions rust/Cargo.lock

This file was deleted.

22 changes: 6 additions & 16 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
[package]
name = "links-notation"
version = "0.13.0"
edition = "2021"
description = "Rust implementation of the Links Notation parser"
license = "Unlicense"
repository = "https://github.com/link-foundation/links-notation"
keywords = ["lino", "parser", "links", "notation", "protocol"]
categories = ["parsing"]

[lib]
name = "links_notation"
path = "src/lib.rs"

[dependencies]
nom = "8.0"
[workspace]
members = [
"links-notation",
"links-notation-macro",
]
resolver = "2"
15 changes: 15 additions & 0 deletions rust/links-notation-macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "links-notation-macro"
version = "0.1.0"
edition = "2021"
description = "Procedural macro for Links Notation compile-time parsing"
license = "Unlicense"
repository = "https://github.com/link-foundation/links-notation"

[lib]
proc-macro = true

[dependencies]
syn = { version = "2.0", features = ["full", "extra-traits"] }
quote = "1.0"
proc-macro2 = "1.0"
Loading