Skip to content

Commit c5eea3e

Browse files
committed
github action caching, some docs
1 parent 60f51e5 commit c5eea3e

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

.github/workflows/antlr.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ jobs:
2929
with:
3030
toolchain: nightly-2020-12-23
3131
default: true
32+
- name: Cache local Maven repository
33+
uses: actions/cache@v2
34+
with:
35+
path: ~/.m2/repository
36+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
37+
restore-keys: |
38+
${{ runner.os }}-maven-
3239
- name: Build with Maven
3340
run : mvn -DskipTests install -q
3441
- name : Maven tests

.github/workflows/publish.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
with:
1515
toolchain: nightly-2020-12-23
1616
default: true
17-
- name: Cargo publish
17+
- name: Cargo publish check
1818
env:
1919
CRATES_IO_PUBLISH_TOKEN: ${{ secrets.CRATES_IO_PUBLISH_TOKEN }}
2020
run: |
@@ -35,7 +35,7 @@ jobs:
3535
with:
3636
tag_name: antlr4-4.8-2-Rust-0.2
3737
release_name: antlr4-4.8-2-Rust-0.2
38-
draft: true
38+
draft: false
3939
prerelease: false
4040
- name: Upload Release Asset
4141
uses: actions/upload-release-asset@v1
@@ -47,3 +47,5 @@ jobs:
4747
asset_name: antlr4-4.8-2-SNAPSHOT-complete.jar
4848
asset_content_type: application/java-archive
4949

50+
- name: Cargo publish
51+
run: cargo publish

src/rule_context.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::parser_rule_context::ParserRuleContext;
1212
use crate::token_factory::TokenFactory;
1313
use crate::tree::{ParseTree, Tree};
1414
use better_any::{Tid, TidAble};
15+
use std::any::type_name;
1516

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

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

196199
impl<'input, ExtCtx: CustomRuleContext<'input>> Debug for BaseRuleContext<'input, ExtCtx> {
197-
fn fmt(&self, _f: &mut Formatter<'_>) -> std::fmt::Result { unimplemented!() }
200+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
201+
f.debug_struct(type_name::<Self>())
202+
.field("invoking_state", &self.invoking_state)
203+
.field("..", &"..")
204+
.finish()
205+
}
198206
}
199207

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

0 commit comments

Comments
 (0)