Skip to content

Commit

Permalink
github action caching, some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rrevenantt committed Jan 4, 2021
1 parent 60f51e5 commit c5eea3e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/antlr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ jobs:
with:
toolchain: nightly-2020-12-23
default: true
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run : mvn -DskipTests install -q
- name : Maven tests
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
toolchain: nightly-2020-12-23
default: true
- name: Cargo publish
- name: Cargo publish check
env:
CRATES_IO_PUBLISH_TOKEN: ${{ secrets.CRATES_IO_PUBLISH_TOKEN }}
run: |
Expand All @@ -35,7 +35,7 @@ jobs:
with:
tag_name: antlr4-4.8-2-Rust-0.2
release_name: antlr4-4.8-2-Rust-0.2
draft: true
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
Expand All @@ -47,3 +47,5 @@ jobs:
asset_name: antlr4-4.8-2-SNAPSHOT-complete.jar
asset_content_type: application/java-archive

- name: Cargo publish
run: cargo publish
10 changes: 9 additions & 1 deletion src/rule_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::parser_rule_context::ParserRuleContext;
use crate::token_factory::TokenFactory;
use crate::tree::{ParseTree, Tree};
use better_any::{Tid, TidAble};
use std::any::type_name;

//pub trait RuleContext:RuleNode {
/// Minimal rule context functionality required for parser to work properly
Expand Down Expand Up @@ -101,8 +102,10 @@ impl<'a, TF: TokenFactory<'a>> ParserNodeType<'a> for EmptyContextType<'a, TF> {
#[allow(missing_docs)]
pub trait CustomRuleContext<'input> {
type TF: TokenFactory<'input> + 'input;
/// Type that describes type of context nodes, stored in this context
type Ctx: ParserNodeType<'input, TF = Self::TF>;
//const RULE_INDEX:usize;
/// Rule index that corresponds to this context type
fn get_rule_index(&self) -> usize;

fn get_alt_number(&self) -> isize { INVALID_ALT }
Expand Down Expand Up @@ -194,7 +197,12 @@ impl<'input, ExtCtx: CustomRuleContext<'input>> RuleContext<'input>
}

impl<'input, ExtCtx: CustomRuleContext<'input>> Debug for BaseRuleContext<'input, ExtCtx> {
fn fmt(&self, _f: &mut Formatter<'_>) -> std::fmt::Result { unimplemented!() }
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_struct(type_name::<Self>())
.field("invoking_state", &self.invoking_state)
.field("..", &"..")
.finish()
}
}

impl<'input, ExtCtx: CustomRuleContext<'input>> Tree<'input> for BaseRuleContext<'input, ExtCtx> {}
Expand Down

0 comments on commit c5eea3e

Please sign in to comment.