Skip to content

fix: ugprade rust toolchain to nightly-2021-11-30 #40

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

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/antlr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_VERSION: nightly-2021-04-23
RUST_VERSION: nightly-2021-11-30

jobs:
tests-antlr:
Expand Down
9 changes: 2 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
use std::convert::TryInto;
use std::env;
use std::env::VarError;
use std::error::Error;
use std::fs::{read_dir, DirEntry, File};
use std::io::Write;
use std::path::Path;
use std::process::Command;

fn main() {
Expand Down Expand Up @@ -33,14 +28,14 @@ fn gen_for_grammar(
grammar_file_name: &str,
antlr_path: &str,
additional_arg: Option<&str>,
) -> Result<(), Box<Error>> {
) -> Result<(), Box<dyn Error>> {
// let out_dir = env::var("OUT_DIR").unwrap();
// let dest_path = Path::new(&out_dir);

let input = env::current_dir().unwrap().join("grammars");
let file_name = grammar_file_name.to_owned() + ".g4";

let c = Command::new("java")
let _c = Command::new("java")
.current_dir(input)
.arg("-cp")
.arg(antlr_path)
Expand Down
1 change: 1 addition & 0 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nightly-2021-11-30
10 changes: 1 addition & 9 deletions src/atn_deserialization_options.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
#[derive(Debug)]
pub struct ATNDeserializationOptions {
read_only: bool,
verify_atn: bool,
generate_rule_bypass_transitions: bool,
}

impl ATNDeserializationOptions {
pub fn is_verify(&self) -> bool { self.verify_atn }
}

impl Default for ATNDeserializationOptions {
fn default() -> Self {
ATNDeserializationOptions {
read_only: true,
verify_atn: true,
generate_rule_bypass_transitions: false,
}
}
fn default() -> Self { ATNDeserializationOptions { verify_atn: true } }
}
8 changes: 3 additions & 5 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ impl InputMisMatchError {
pub struct FailedPredicateError {
pub base: BaseRecognitionError,
pub rule_index: isize,
predicate_index: isize,
pub predicate: String,
}

Expand All @@ -235,11 +234,11 @@ impl FailedPredicateError {
.get_transitions()
.first()
.unwrap();
let (rule_index, predicate_index) = if tr.get_serialization_type() == TRANSITION_PREDICATE {
let rule_index = if tr.get_serialization_type() == TRANSITION_PREDICATE {
let pr = tr.deref().cast::<PredicateTransition>();
(pr.rule_index, pr.pred_index)
pr.rule_index
} else {
(0, 0)
0
};

ANTLRError::PredicateError(FailedPredicateError {
Expand All @@ -255,7 +254,6 @@ impl FailedPredicateError {
states_stack: states_stack(recog.get_parser_rule_context().clone()).collect(), // ctx: recog.get_parser_rule_context().clone()
},
rule_index,
predicate_index,
predicate: predicate.unwrap_or_default(),
})
}
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![crate_type = "lib"]
#![feature(try_blocks)]
//#![feature(nll)]
#![feature(raw)]
#![feature(is_sorted)]
#![feature(cell_update)]
#![feature(get_mut_unchecked)]
Expand Down
1 change: 0 additions & 1 deletion src/token_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use crate::token::Token;
use crate::token::{CommonToken, OwningToken, TOKEN_INVALID_TYPE};
use better_any::{Tid, TidAble};

#[allow(non_upper_case_globals)]
lazy_static! {
pub(crate) static ref COMMON_TOKEN_FACTORY_DEFAULT: Box<CommonTokenFactory> =
Box::new(CommonTokenFactory {});
Expand Down