Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmtcn123 committed Jan 5, 2022
1 parent 73db1a6 commit 639dc37
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 44 deletions.
4 changes: 2 additions & 2 deletions core/src/definite/items/native_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use serde::{Deserialize, Serialize};

#[derive(PartialEq, Debug, Clone, Serialize, Deserialize)]
pub struct NativeFunction {
pub name: String, //NativeFunction Name string
pub name: String, //NativeFunction Name string
pub parameters: Vec<super::function::FunctionParameter>, //Parameter vector
pub return_type: definers::DefinerCollecting, //Return type from enum
pub return_type: definers::DefinerCollecting, //Return type from enum
pub public: bool,
pub name_pos: defs::Cursor, //Name position fn [test] ......
pub parameters_pos: defs::Cursor,
Expand Down
2 changes: 1 addition & 1 deletion core/src/definite/types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod array;
pub mod as_keyword;
pub mod bool;
pub mod brace_reference;
pub mod class_call;
Expand All @@ -15,7 +16,6 @@ pub mod reference;
pub mod string;
pub mod variable;
pub mod vector;
pub mod as_keyword;

use serde::{Deserialize, Serialize};

Expand Down
7 changes: 6 additions & 1 deletion parser/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,12 @@ impl Parser {
}
}

pub fn parse(&mut self, module_name: String, module_description: String, ellie_version: defs::Version) -> Module {
pub fn parse(
&mut self,
module_name: String,
module_description: String,
ellie_version: defs::Version,
) -> Module {
self.process_page(self.initial_page);
Module {
name: module_name,
Expand Down
2 changes: 1 addition & 1 deletion parser/src/processors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ pub mod definer_processor;
pub mod file_key;
pub mod function;
pub mod import;
pub mod ret;
pub mod type_processor;
pub mod variable;
pub mod ret;

pub trait Processor {
fn process(self, parser: &mut Parser, page_id: u64);
Expand Down
52 changes: 26 additions & 26 deletions parser/src/processors/ret.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
use ellie_core::defs;
use ellie_tokenizer::syntax::items::ret::Ret;

impl super::Processor for Ret {
fn process(self, parser: &mut super::Parser, page_id: u64) {
match super::type_processor::process(self.value.current, parser, page_id, None) {
Ok(value) => {
let unprocessed_page = parser.find_page(page_id).unwrap();
unprocessed_page.unreachable = true;
unprocessed_page.unreachable_range.range_start =
defs::CursorPosition(self.pos.range_end.0 + 1, 0);
let page = parser.find_processed_page(page_id).unwrap();
page.items
.push(ellie_core::definite::items::Collecting::Ret(
ellie_core::definite::items::ret::Ret {
value: value,
keyword_pos: self.keyword_pos,
value_position: self.value_position,
pos: self.pos,
},
));
}
Err(type_error) => parser.informations.extend(&type_error),
}
}
}
use ellie_core::defs;
use ellie_tokenizer::syntax::items::ret::Ret;

impl super::Processor for Ret {
fn process(self, parser: &mut super::Parser, page_id: u64) {
match super::type_processor::process(self.value.current, parser, page_id, None) {
Ok(value) => {
let unprocessed_page = parser.find_page(page_id).unwrap();
unprocessed_page.unreachable = true;
unprocessed_page.unreachable_range.range_start =
defs::CursorPosition(self.pos.range_end.0 + 1, 0);
let page = parser.find_processed_page(page_id).unwrap();
page.items
.push(ellie_core::definite::items::Collecting::Ret(
ellie_core::definite::items::ret::Ret {
value: value,
keyword_pos: self.keyword_pos,
value_position: self.value_position,
pos: self.pos,
},
));
}
Err(type_error) => parser.informations.extend(&type_error),
}
}
}
20 changes: 15 additions & 5 deletions parser/src/processors/type_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,25 @@ pub fn process(
Vec::new(),
0,
);


if deep_search_result.found {
match deep_search_result.found_item {
crate::parser::DeepSearchItems::Class(_) => todo!("class type not yet implemented"),
crate::parser::DeepSearchItems::Class(_) => {
todo!("class type not yet implemented")
}
crate::parser::DeepSearchItems::Variable(e) => {
Ok(types::Types::VariableType(types::variable::VariableType {
value: e.name,
reference: e.hash,
pos: from.get_pos(),
}))
}
crate::parser::DeepSearchItems::Function(_) => todo!("function type not yet implemented"),
crate::parser::DeepSearchItems::ImportReference(_) => todo!("import reference type not yet implemented"),
crate::parser::DeepSearchItems::Function(_) => {
todo!("function type not yet implemented")
}
crate::parser::DeepSearchItems::ImportReference(_) => {
todo!("import reference type not yet implemented")
}
crate::parser::DeepSearchItems::BrokenPageGraph => todo!(),
crate::parser::DeepSearchItems::MixUp(_) => todo!(),
crate::parser::DeepSearchItems::None => todo!(),
Expand Down Expand Up @@ -79,7 +84,12 @@ pub fn process(
Processors::Cloak(_) => todo!("cloak type not yet implemented"),
Processors::Collective(_) => todo!("collective type not yet implemented"),
Processors::AsKeyword(as_keyword) => {
match process(*as_keyword.data.target, parser, page_id, ignore_hash.clone()) {
match process(
*as_keyword.data.target,
parser,
page_id,
ignore_hash.clone(),
) {
Ok(resolved_types) => {
match crate::processors::definer_processor::process(
as_keyword.data.rtype.definer_type,
Expand Down
2 changes: 1 addition & 1 deletion parser/standard_rules/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ lazy_static! {
});
(param_name == fixed, fixed)
}
};
};
pub static ref FUNCTION_PARAM_NAMING_ISSUE: Rule<String, (bool, String)> = Rule {
warning_id: 0x02,
worker: |param_name| {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ extern crate ellie_tokenizer;
#[cfg(feature = "build-cli")]
#[macro_use]
extern crate lazy_static;
pub mod engine_constants;
pub mod cli_outputs;
pub mod cli_utils;
pub mod compile_file;
pub mod view_module;
pub mod engine_constants;
pub mod view_module;
4 changes: 2 additions & 2 deletions tokenizer/src/syntax/items/condition.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::processors::items;
use crate::processors::types::{self, TypeProcessor};
use ellie_core::definite::Converter;
use ellie_core::defs;
use serde::{Deserialize, Serialize};
use crate::processors::items;
use crate::processors::types::{self, TypeProcessor};

#[derive(PartialEq, Debug, Clone, Serialize, Deserialize)]
pub enum ConditionType {
Expand Down
3 changes: 1 addition & 2 deletions tokenizer/src/syntax/items/definers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ impl definite::Converter<DefinerTypes, definite::definers::DefinerCollecting> fo
DefinerTypes::Cloak(e) => {
definite::definers::DefinerCollecting::Cloak(definite::definers::CloakType {
rtype: e.entries.into_iter().map(|x| x.to_definite()).collect(),
pos: e.pos,

pos: e.pos,
})
}
DefinerTypes::Array(e) => {
Expand Down
2 changes: 1 addition & 1 deletion tokenizer/src/syntax/types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod array_type;
pub mod as_keyword;
pub mod brace_reference_type;
pub mod char_type;
pub mod class_call_type;
Expand All @@ -12,4 +13,3 @@ pub mod operator_type;
pub mod reference_type;
pub mod string_type;
pub mod variable_type;
pub mod as_keyword;

0 comments on commit 639dc37

Please sign in to comment.