rrevenantt / antlr4rust

ANTLR4 parser generator runtime for Rust programming laguage
Other
398 stars 70 forks source link

failed to resolve: could not find `impl_tid` in `antlr_rust` #50

Closed yuriry closed 2 years ago

yuriry commented 2 years ago

I'm not sure if my build environment is set up properly when I get the errors below.

Cargo.toml

[package]
name = "parser-test"
version = "0.1.0"
edition = "2021"

[dependencies]
antlr-rust = { git = "https://github.com/rrevenantt/antlr4rust", branch = "v0.3" }

A script that generates rust code from a grammar file:

#!/bin/bash
pushd grammars
java -jar ~/bin/antlr4-4.8-2-SNAPSHOT-complete.jar -Dlanguage=Rust -o ../src/parsers ArrayInit.g4
popd

antlr4-4.8-2-SNAPSHOT-complete.jar is built from rust-target branch.

Tool chain is nightly:

stable-x86_64-unknown-linux-gnu (default)
beta-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (override)

I had to add #![feature(try_blocks)] to main.rs to disable two try expression is experimental errors:

#![feature(try_blocks)]

mod parsers;

parsers/mod.rs:

mod arrayinitparser;
mod arrayinitlexer;
mod arrayinitlistener;

Any help on how to properly setup a working build environment would be greatly appreciated.

image

yuriry commented 2 years ago

After checking out v0.3 branch of this project and re-building it using my version of antlr4-4.8-2-SNAPSHOT-complete.jar I got the same errors when running cargo test as in my parser test . What would be the correct version of antlr4-4.8-2-SNAPSHOT-complete.jar to work with v0.3 branch?

rrevenantt commented 2 years ago

I have just published a prerelease for v0.3: https://github.com/rrevenantt/antlr4rust/releases/tag/antlr4-4.8-2-Rust0.3.0-beta, does the issue still exists if you use antlr tool available with it?

yuriry commented 2 years ago

Thank you so much, it works with master now!

[dependencies]
antlr-rust = { git = "https://github.com/rrevenantt/antlr4rust", branch = "master" }