fix: fix lint

上级 09ef5393
......@@ -5,8 +5,8 @@ use onig::*;
use crate::grammar::line_tokens::{LineTokens, TokenTypeMatcher};
use crate::grammar::{ScopeListElement, StackElement};
use crate::inter::{IRawGrammar, IRawRepository, IRawRepositoryMap, IRawRule};
use crate::rule::{AbstractRule, EmptyRule, IGrammarRegistry, IRuleFactoryHelper, IRuleRegistry};
use crate::rule::rule_factory::RuleFactory;
use crate::rule::{AbstractRule, EmptyRule, IGrammarRegistry, IRuleFactoryHelper, IRuleRegistry};
pub mod scope_list_element;
pub mod scope_metadata;
......@@ -107,15 +107,17 @@ impl Grammar {
if self.root_id.clone() == -1 {
let mut repository = self.grammar.repository.clone().unwrap();
let based = repository.clone().map.self_s.unwrap();
self.root_id =
RuleFactory::get_compiled_rule_id(based.clone(), self, &mut repository.clone(), String::from(""));
self.root_id = RuleFactory::get_compiled_rule_id(
based.clone(),
self,
&mut repository.clone(),
String::from(""),
);
}
let mut is_first_line: bool = false;
match prev_state.clone() {
None => {
is_first_line = true
}
None => is_first_line = true,
Some(state) => {
if state == StackElement::null() {
is_first_line = true
......@@ -125,11 +127,24 @@ impl Grammar {
if is_first_line {
let scope_list = ScopeListElement::default();
prev_state = Some(StackElement::new(None, self.root_id.clone(), -1, -1, false, None, scope_list.clone(), scope_list.clone()))
prev_state = Some(StackElement::new(
None,
self.root_id.clone(),
-1,
-1,
false,
None,
scope_list.clone(),
scope_list.clone(),
))
}
let format_line_text = format!("{:?}\n", line_text);
let line_tokens = LineTokens::new(emit_binary_tokens, line_text, self._token_type_matchers.clone());
let line_tokens = LineTokens::new(
emit_binary_tokens,
line_text,
self._token_type_matchers.clone(),
);
self.tokenize_string(
format_line_text.parse().unwrap(),
is_first_line,
......@@ -164,8 +179,13 @@ impl Grammar {
);
}
self.match_rule_or_injections(line_text, is_first_line, line_pos, prev_state, anchor_position);
self.match_rule_or_injections(
line_text,
is_first_line,
line_pos,
prev_state,
anchor_position,
);
}
pub fn check_while_conditions(
......@@ -177,7 +197,9 @@ impl Grammar {
line_tokens: LineTokens,
) {
let mut anchor_position = -1;
if _stack.begin_rule_captured_eol { anchor_position = 0 }
if _stack.begin_rule_captured_eol {
anchor_position = 0
}
// let while_rules = vec![];
}
......@@ -189,7 +211,13 @@ impl Grammar {
stack: StackElement,
anchor_position: i32,
) {
self.match_rule(line_text, is_first_line, line_pos, stack.clone(), anchor_position);
self.match_rule(
line_text,
is_first_line,
line_pos,
stack.clone(),
anchor_position,
);
}
pub fn match_rule(
......
use core::ptr;
use crate::grammar::{Grammar, ScopeListElement};
use crate::grammar::grammar_registry::GrammarRegistry;
use crate::rule::{IRuleRegistry, AbstractRule};
use crate::grammar::{Grammar, ScopeListElement};
use crate::rule::{AbstractRule, IRuleRegistry};
use core::ptr;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StackElement {
......@@ -27,8 +27,7 @@ impl StackElement {
begin_rule_captured_eol: false,
end_rule: None,
name_scopes_list: Default::default(),
content_name_scopes_list: Default::default()
content_name_scopes_list: Default::default(),
}
}
......@@ -38,7 +37,16 @@ impl StackElement {
pub fn get_rule(&self, grammar: &mut Grammar) -> Box<dyn AbstractRule> {
grammar.get_rule(self.rule_id)
}
pub fn new(parent: Option<Box<StackElement>>, rule_id: i32, enter_pos: i32, anchor_pos: i32, begin_rule_captured_eol: bool, end_rule: Option<String>, name_scopes_list: ScopeListElement, content_name_scopes_list: ScopeListElement) -> Self {
pub fn new(
parent: Option<Box<StackElement>>,
rule_id: i32,
enter_pos: i32,
anchor_pos: i32,
begin_rule_captured_eol: bool,
end_rule: Option<String>,
name_scopes_list: ScopeListElement,
content_name_scopes_list: ScopeListElement,
) -> Self {
StackElement {
parent,
// todo: this.depth = (this.parent ? this.parent.depth + 1 : 1);
......@@ -49,7 +57,7 @@ impl StackElement {
begin_rule_captured_eol,
end_rule,
name_scopes_list,
content_name_scopes_list
content_name_scopes_list,
}
}
}
......@@ -5,7 +5,7 @@ pub struct TokenTypeMatcher {}
pub struct IToken {
pub start_index: i32,
pub end_index: i32,
pub scopes: Vec<String>
pub scopes: Vec<String>,
}
#[derive(Debug, Clone)]
......@@ -15,19 +15,22 @@ pub struct LineTokens {
pub _tokens: Vec<IToken>,
pub _binary_tokens: Vec<IToken>,
pub _last_token_end_index: i32,
pub _token_type_overrides: Vec<TokenTypeMatcher>
pub _token_type_overrides: Vec<TokenTypeMatcher>,
}
impl LineTokens {
pub fn new(emit_binary_tokens: bool, _line_text: String, _token_type_overrides: Vec<TokenTypeMatcher>) -> Self {
pub fn new(
emit_binary_tokens: bool,
_line_text: String,
_token_type_overrides: Vec<TokenTypeMatcher>,
) -> Self {
LineTokens {
emit_binary_tokens,
_line_text,
_tokens: vec![],
_binary_tokens: vec![],
_last_token_end_index: 0,
_token_type_overrides
_token_type_overrides,
}
}
}
pub mod grammar;
pub mod grammar_reader;
pub mod line_tokens;
pub mod grammar_registry;
pub mod line_tokens;
pub use self::grammar::Grammar;
pub use self::grammar::stack_element::StackElement;
pub use self::grammar::scope_list_element::ScopeListElement;
pub use self::grammar::scope_metadata::ScopeMetadata;
pub use self::grammar::stack_element::StackElement;
pub use self::grammar::Grammar;
......@@ -20,7 +20,7 @@ impl ILocation {
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct ILocatable {
#[serde(flatten, skip_serializing_if="Option::is_none")]
#[serde(flatten, skip_serializing_if = "Option::is_none")]
pub textmate_location: Option<ILocation>,
}
......@@ -42,9 +42,9 @@ pub struct IRawCapturesMap {
pub struct IRawRepositoryMap {
#[serde(flatten)]
pub name_map: HashMap<String, Box<IRawRule>>,
#[serde(skip_serializing_if="Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub self_s: Option<IRawRule>,
#[serde(skip_serializing_if="Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub base_s: Option<IRawRule>,
}
......@@ -62,7 +62,7 @@ impl IRawRepositoryMap {
pub struct IRawRepository {
#[serde(flatten)]
pub map: Box<IRawRepositoryMap>,
#[serde(skip_serializing_if="Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<ILocation>,
}
......@@ -79,19 +79,19 @@ impl IRawRepository {
pub struct IRawCaptures {
#[serde(flatten)]
pub map: IRawCapturesMap,
#[serde(skip_serializing_if="Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<ILocatable>,
}
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
pub struct IRawRule {
pub id: Option<i32>,
#[serde(skip_serializing_if="Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub location: Option<ILocation>,
#[serde(skip_serializing_if="Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub include: Option<String>,
#[serde(skip_serializing_if="Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(alias = "contentName")]
......@@ -99,34 +99,34 @@ pub struct IRawRule {
#[serde(alias = "match")]
pub match_s: Option<String>,
#[serde(skip_serializing_if="Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub captures: Option<Box<IRawCaptures>>,
#[serde(skip_serializing_if="Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub begin: Option<String>,
#[serde(alias = "beginCaptures", skip_serializing_if="Option::is_none")]
#[serde(alias = "beginCaptures", skip_serializing_if = "Option::is_none")]
pub begin_captures: Option<Box<IRawCaptures>>,
#[serde(skip_serializing_if="Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub end: Option<String>,
#[serde(alias = "endCaptures", skip_serializing_if="Option::is_none")]
#[serde(alias = "endCaptures", skip_serializing_if = "Option::is_none")]
pub end_captures: Option<Box<IRawCaptures>>,
#[serde(alias = "while", skip_serializing_if="Option::is_none")]
#[serde(alias = "while", skip_serializing_if = "Option::is_none")]
pub while_s: Option<String>,
#[serde(alias = "whileCaptures", skip_serializing_if="Option::is_none")]
#[serde(alias = "whileCaptures", skip_serializing_if = "Option::is_none")]
pub while_captures: Option<Box<IRawCaptures>>,
#[serde(skip_serializing_if="Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub patterns: Option<Vec<IRawRule>>,
#[serde(skip_serializing_if="Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub repository: Option<IRawRepository>,
#[serde(alias = "applyEndPatternLast", skip_serializing_if="Option::is_none")]
#[serde(alias = "applyEndPatternLast", skip_serializing_if = "Option::is_none")]
pub apply_end_pattern_last: Option<bool>,
#[serde(skip_serializing_if="Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub information_for_contributors: Option<Vec<String>>,
}
......
......@@ -8,5 +8,5 @@ extern crate erased_serde;
pub mod grammar;
pub mod inter;
pub mod rule;
pub mod matcher;
pub mod rule;
......@@ -9,6 +9,4 @@ pub struct MatcherWithPriority {
priority: MatchPriority,
}
pub struct Matcher {
}
\ No newline at end of file
pub struct Matcher {}
use dyn_clone::{clone_trait_object, DynClone};
use core::fmt;
use crate::rule::{IRuleRegistry, RegExpSourceList};
use core::fmt;
use dyn_clone::{clone_trait_object, DynClone};
pub trait AbstractRule: DynClone + erased_serde::Serialize {
fn id(&self) -> i32;
......@@ -8,8 +8,21 @@ pub trait AbstractRule: DynClone + erased_serde::Serialize {
fn has_missing_pattern(&self) -> bool {
false
}
fn collect_patterns_recursive(&self, grammar: Box<dyn IRuleRegistry>, out: RegExpSourceList, is_first: bool) {}
fn compile(&self, grammar: Box<dyn IRuleRegistry>, end_regex_source: Option<String>, allow_a: bool, allow_g: bool) {}
fn collect_patterns_recursive(
&self,
grammar: Box<dyn IRuleRegistry>,
out: RegExpSourceList,
is_first: bool,
) {
}
fn compile(
&self,
grammar: Box<dyn IRuleRegistry>,
end_regex_source: Option<String>,
allow_a: bool,
allow_g: bool,
) {
}
}
impl fmt::Debug for dyn AbstractRule {
......@@ -21,4 +34,3 @@ impl fmt::Debug for dyn AbstractRule {
serialize_trait_object!(AbstractRule);
clone_trait_object!(AbstractRule);
use crate::rule::{RegExpSource, RegExpSourceList};
use crate::rule::{Rule, AbstractRule};
use crate::inter::ILocation;
use crate::rule::rule_factory::ICompilePatternsResult;
use crate::rule::{AbstractRule, Rule};
use crate::rule::{RegExpSource, RegExpSourceList};
#[derive(Clone, Debug, Serialize)]
pub struct BeginEndRule {
......@@ -54,7 +54,9 @@ impl BeginEndRule {
}
impl AbstractRule for BeginEndRule {
fn id(&self) -> i32 { self.rule.id }
fn id(&self) -> i32 {
self.rule.id
}
fn type_of(&self) -> String {
String::from(self.rule.clone()._type)
}
......@@ -62,4 +64,3 @@ impl AbstractRule for BeginEndRule {
self.has_missing_patterns
}
}
use crate::inter::ILocation;
use crate::rule::rule_factory::ICompilePatternsResult;
use crate::rule::{AbstractRule, Rule};
use crate::rule::{RegExpSource, RegExpSourceList};
use crate::rule::rule_factory::ICompilePatternsResult;
use crate::inter::ILocation;
#[derive(Clone, Debug, Serialize)]
pub struct BeginWhileRule {
......@@ -54,7 +54,9 @@ impl BeginWhileRule {
}
impl AbstractRule for BeginWhileRule {
fn id(&self) -> i32 { self.rule.id }
fn id(&self) -> i32 {
self.rule.id
}
fn type_of(&self) -> String {
String::from(self.rule.clone()._type)
}
......
use crate::rule::{Rule, AbstractRule};
use crate::inter::ILocation;
use crate::rule::{AbstractRule, Rule};
#[derive(Clone, Debug, Serialize)]
pub struct CaptureRule {
......@@ -20,7 +20,13 @@ impl CaptureRule {
retokenize_captured_with_rule_id: 0,
}
}
pub fn new(location: Option<ILocation>, id: i32, name: Option<String>, content_name: Option<String>, retokenize_captured_with_rule_id: i32) -> Self {
pub fn new(
location: Option<ILocation>,
id: i32,
name: Option<String>,
content_name: Option<String>,
retokenize_captured_with_rule_id: i32,
) -> Self {
CaptureRule {
rule: Rule {
_type: String::from("CaptureRule"),
......@@ -35,6 +41,10 @@ impl CaptureRule {
}
impl AbstractRule for CaptureRule {
fn id(&self) -> i32 { self.rule.id }
fn type_of(&self) -> String { String::from(self.rule.clone()._type) }
fn id(&self) -> i32 {
self.rule.id
}
fn type_of(&self) -> String {
String::from(self.rule.clone()._type)
}
}
pub struct CompiledRule {
pub debug_reg_exps: Vec<String>,
pub rules: Vec<i32>
pub rules: Vec<i32>,
}
impl CompiledRule {
pub fn new(debug_reg_exps: Vec<String>, rules: Vec<i32>) -> Self {
CompiledRule { debug_reg_exps, rules }
CompiledRule {
debug_reg_exps,
rules,
}
}
}
\ No newline at end of file
}
......@@ -4,7 +4,9 @@ use crate::rule::AbstractRule;
pub struct EmptyRule {}
impl AbstractRule for EmptyRule {
fn id(&self) -> i32 { 0 }
fn id(&self) -> i32 {
0
}
fn type_of(&self) -> String {
String::from("EmptyRule")
}
......
use crate::rule::rule_factory::ICompilePatternsResult;
use crate::rule::{Rule, AbstractRule};
use crate::inter::ILocation;
use crate::rule::rule_factory::ICompilePatternsResult;
use crate::rule::{AbstractRule, Rule};
#[derive(Clone, Debug, Serialize)]
pub struct IncludeOnlyRule {
......@@ -33,7 +33,9 @@ impl IncludeOnlyRule {
}
impl AbstractRule for IncludeOnlyRule {
fn id(&self) -> i32 { self.rule.id }
fn id(&self) -> i32 {
self.rule.id
}
fn type_of(&self) -> String {
String::from(self.rule.clone()._type)
}
......
use crate::rule::{AbstractRule, Rule};
use crate::inter::ILocation;
use crate::rule::RegExpSource;
use crate::rule::{AbstractRule, Rule};
#[derive(Clone, Debug, Serialize)]
pub struct MatchRule {
......@@ -32,7 +32,9 @@ impl MatchRule {
}
impl AbstractRule for MatchRule {
fn id(&self) -> i32 { self.rule.id }
fn id(&self) -> i32 {
self.rule.id
}
fn type_of(&self) -> String {
String::from(self.rule.clone()._type)
}
......
pub mod rule_factory;
pub mod rule_convert;
pub mod rule_factory;
pub mod abstract_rule;
pub mod begin_end_rule;
pub mod begin_while_rule;
pub mod capture_rule;
pub mod compiled_rule;
pub mod empty_rule;
pub mod include_only_rule;
pub mod match_rule;
pub mod capture_rule;
pub mod empty_rule;
pub mod rule;
pub use self::rule::Rule;
pub use self::abstract_rule::AbstractRule;
pub use self::compiled_rule::CompiledRule;
pub use self::begin_end_rule::BeginEndRule;
pub use self::begin_while_rule::BeginWhileRule;
pub use self::include_only_rule::IncludeOnlyRule;
pub use self::match_rule::MatchRule;
pub use self::capture_rule::CaptureRule;
pub use self::compiled_rule::CompiledRule;
pub use self::empty_rule::EmptyRule;
pub use self::include_only_rule::IncludeOnlyRule;
pub use self::match_rule::MatchRule;
pub use self::rule::Rule;
use crate::inter::{ILocation, IRawGrammar, IRawRepository};
use crate::rule::rule_factory::ICompilePatternsResult;
......
......@@ -27,4 +27,4 @@ impl Rule {
_content_name: content_name,
}
}
}
\ No newline at end of file
}
use crate::rule::{
AbstractRule, BeginEndRule, BeginWhileRule, CaptureRule, IncludeOnlyRule, MatchRule,
};
use std::collections::BTreeMap as Map;
use crate::rule::{AbstractRule, MatchRule, IncludeOnlyRule, CaptureRule, BeginWhileRule, BeginEndRule};
#[derive(Serialize, Debug)]
pub struct RuleList {
......@@ -47,15 +49,14 @@ fn abstract_rule_to_json(map: Map<i32, Box<dyn AbstractRule>>) {
println!("{:?}", j);
}
#[cfg(test)]
mod tests {
use crate::grammar::Grammar;
use std::path::Path;
use std::fs::File;
use crate::inter::IRawGrammar;
use std::io::Read;
use crate::rule::rule_convert::abstract_rule_to_json;
use std::fs::File;
use std::io::Read;
use std::path::Path;
#[test]
fn should_build_text_grammar() {
......@@ -82,4 +83,4 @@ GitHub 漫游指南
grammar
}
}
\ No newline at end of file
}
use crate::grammar::Grammar;
use crate::inter::{IRawCaptures, IRawRepository, IRawRule, ILocation};
use crate::rule::{BeginEndRule, BeginWhileRule, CaptureRule, IRuleRegistry, IncludeOnlyRule, MatchRule, AbstractRule, Rule};
use crate::inter::{ILocation, IRawCaptures, IRawRepository, IRawRule};
use crate::rule::{
AbstractRule, BeginEndRule, BeginWhileRule, CaptureRule, IRuleRegistry, IncludeOnlyRule,
MatchRule, Rule,
};
#[derive(Clone, Debug, Serialize)]
pub struct ICompilePatternsResult {
......@@ -33,22 +36,34 @@ impl RuleFactory {
}
}
r.resize((maximum_capture_id + 1) as usize, Box::new(CaptureRule::empty()));
r.resize(
(maximum_capture_id + 1) as usize,
Box::new(CaptureRule::empty()),
);
for (id_str, desc) in capts.clone().map.capture_map {
// todo: figure captureId === '$vscodeTextmateLocation'
let numeric_capture_id: usize = id_str.parse().unwrap_or(0);
let mut retokenize_captured_with_rule_id = 0;
let options_patterns = capts.map.capture_map
.get(&*numeric_capture_id.to_string());
let options_patterns = capts.map.capture_map.get(&*numeric_capture_id.to_string());
if let Some(rule) = options_patterns {
if let Some(patterns) = rule.clone().patterns {
retokenize_captured_with_rule_id =
RuleFactory::get_compiled_rule_id(desc.clone(), helper, repository, String::from(""));
retokenize_captured_with_rule_id = RuleFactory::get_compiled_rule_id(
desc.clone(),
helper,
repository,
String::from(""),
);
}
}
r[numeric_capture_id] = RuleFactory::create_capture_rule(helper, desc.clone().location, desc.clone().name, desc.clone().content_name, retokenize_captured_with_rule_id);
r[numeric_capture_id] = RuleFactory::create_capture_rule(
helper,
desc.clone().location,
desc.clone().name,
desc.clone().content_name,
retokenize_captured_with_rule_id,
);
}
// todo: remove first element, because it's filled & empty.
};
......@@ -56,14 +71,25 @@ impl RuleFactory {
r
}
pub fn create_capture_rule(helper: &mut Grammar, location: Option<ILocation>, name: Option<String>, content_name: Option<String>, retokenizeCapturedWithRuleId: i32) -> Box<dyn AbstractRule> {
pub fn create_capture_rule(
helper: &mut Grammar,
location: Option<ILocation>,
name: Option<String>,
content_name: Option<String>,
retokenizeCapturedWithRuleId: i32,
) -> Box<dyn AbstractRule> {
let id = helper.register_id();
let rule = CaptureRule::new(location, id, name, content_name, retokenizeCapturedWithRuleId);
let rule = CaptureRule::new(
location,
id,
name,
content_name,
retokenizeCapturedWithRuleId,
);
helper.register_rule(Box::from(rule));
return helper.get_rule(id);
}
pub fn compile_patterns(
origin_patterns: Option<Vec<IRawRule>>,
helper: &mut Grammar,
......@@ -92,7 +118,8 @@ impl RuleFactory {
);
}
} else if include_s == "$base" || include_s == "$self" {
let local_included_rule = repository.map.name_map.get_mut(include_s.as_str());
let local_included_rule =
repository.map.name_map.get_mut(include_s.as_str());
if let Some(mut rule) = local_included_rule.cloned() {
pattern_id = RuleFactory::get_compiled_rule_id(
*rule,
......@@ -123,15 +150,22 @@ impl RuleFactory {
}
}
} else {
pattern_id =
RuleFactory::get_compiled_rule_id(pattern, helper, repository, String::from(""));
pattern_id = RuleFactory::get_compiled_rule_id(
pattern,
helper,
repository,
String::from(""),
);
}
if pattern_id != -1 {
let rule = helper.get_rule(pattern_id);
let mut skip_rule = false;
if rule.type_of() == "IncludeOnlyRule" || rule.type_of() == "BeginEndRule" || rule.type_of() == "BeginWhileRule" {
if rule.has_missing_pattern() {
if rule.type_of() == "IncludeOnlyRule"
|| rule.type_of() == "BeginEndRule"
|| rule.type_of() == "BeginWhileRule"
{
if rule.has_missing_pattern() {
skip_rule = true;
}
}
......@@ -151,12 +185,12 @@ impl RuleFactory {
if 0 != r.len() {
has_missing_patterns = true
}
},
}
Some(patterns) => {
if patterns.len() != r.len() {
has_missing_patterns = true
}
},
}
}
let result = ICompilePatternsResult {
......@@ -182,16 +216,17 @@ impl RuleFactory {
// by name.
if desc_name != "" {
if let Some(a) = repository.map.name_map.get(desc_name.as_str()).clone() {
repository.map.name_map.get_mut(desc_name.as_str()).unwrap().id = Some(id);
repository
.map
.name_map
.get_mut(desc_name.as_str())
.unwrap()
.id = Some(id);
}
}
if let Some(match_s) = desc.match_s {
let rule_factory = RuleFactory::compile_captures(
desc.captures,
helper,
repository,
);
let rule_factory = RuleFactory::compile_captures(desc.captures, helper, repository);
let match_rule = MatchRule::new(
desc.location.clone(),
id.clone(),
......@@ -206,7 +241,11 @@ impl RuleFactory {
if let None = desc.begin {
if let Some(repo) = desc.repository.clone() {
desc.repository.unwrap().map.name_map.extend(repository.clone().map.name_map);
desc.repository
.unwrap()
.map
.name_map
.extend(repository.clone().map.name_map);
}
let mut patterns = desc.patterns;
......@@ -218,8 +257,7 @@ impl RuleFactory {
}
}
let rule_factory =
RuleFactory::compile_patterns(patterns, helper, repository);
let rule_factory = RuleFactory::compile_patterns(patterns, helper, repository);
let include_only_rule = IncludeOnlyRule::new(
desc.location.clone(),
id.clone(),
......@@ -247,11 +285,8 @@ impl RuleFactory {
RuleFactory::compile_captures(begin_captures, helper, repository);
let end_rule_factory =
RuleFactory::compile_captures(end_captures, helper, repository);
let pattern_factory = RuleFactory::compile_patterns(
desc.patterns,
helper,
repository,
);
let pattern_factory =
RuleFactory::compile_patterns(desc.patterns, helper, repository);
let begin_while_rule = BeginWhileRule::new(
desc.location,
......@@ -271,13 +306,8 @@ impl RuleFactory {
let begin_rule_factory =
RuleFactory::compile_captures(begin_captures, helper, repository);
let end_rule_factory =
RuleFactory::compile_captures(end_captures, helper, repository);
let pattern_factory = RuleFactory::compile_patterns(
desc.patterns,
helper,
repository,
);
let end_rule_factory = RuleFactory::compile_captures(end_captures, helper, repository);
let pattern_factory = RuleFactory::compile_patterns(desc.patterns, helper, repository);
// todo: register with compile patterns
let begin_end_rule = BeginEndRule::new(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册