-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
205 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone)] | ||
pub struct CodeAnnotation { | ||
pub name: String, | ||
pub key_values: Vec<AnnotationKeyValue> | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone)] | ||
pub struct AnnotationKeyValue { | ||
pub key: String, | ||
pub values: Vec<AnnotationKeyValue> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::domain::code_function::CodeFunction; | ||
use crate::domain::CodePoint; | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone)] | ||
pub struct CodeClass { | ||
pub name: String, | ||
pub package: String, | ||
pub extends: Vec<String>, | ||
pub implements: Vec<String>, | ||
pub constant: Vec<ClassConstant>, | ||
pub functions: Vec<CodeFunction>, | ||
pub start: CodePoint, | ||
pub end: CodePoint | ||
} | ||
|
||
impl Default for CodeClass { | ||
fn default() -> Self { | ||
CodeClass { | ||
name: "".to_string(), | ||
package: "".to_string(), | ||
extends: vec![], | ||
implements: vec![], | ||
constant: vec![], | ||
functions: vec![], | ||
start: Default::default(), | ||
end: Default::default() | ||
} | ||
} | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone)] | ||
pub struct ClassConstant { | ||
pub name: String, | ||
pub typ: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::domain::code_function::CodeFunction; | ||
use crate::domain::code_class::CodeClass; | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone)] | ||
pub struct CodeFile { | ||
pub name: String, | ||
pub path: String, | ||
pub package: String, | ||
pub imports: Vec<String>, | ||
pub classes: Vec<CodeClass>, | ||
pub functions: Vec<CodeFunction>, | ||
} | ||
|
||
impl Default for CodeFile { | ||
fn default() -> Self { | ||
CodeFile { | ||
name: "".to_string(), | ||
path: "".to_string(), | ||
package: "".to_string(), | ||
imports: vec![], | ||
classes: vec![], | ||
functions: vec![], | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::domain::CodePoint; | ||
use crate::domain::Location; | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone)] | ||
pub struct CodeFunction { | ||
pub name: String, | ||
// todo: thinking in access | ||
pub vars: Vec<String>, | ||
pub start: CodePoint, | ||
pub end: CodePoint | ||
} | ||
|
||
impl Default for CodeFunction { | ||
fn default() -> Self { | ||
CodeFunction { | ||
name: "".to_string(), | ||
vars: vec![], | ||
start: Default::default(), | ||
end: Default::default() | ||
} | ||
} | ||
} | ||
|
||
impl Location for CodeFunction { | ||
fn set_start(&mut self, row: usize, column: usize) { | ||
self.start.row = row; | ||
self.start.column = column; | ||
} | ||
|
||
fn set_end(&mut self, row: usize, column: usize) { | ||
self.end.row = row; | ||
self.end.column = column; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone)] | ||
pub struct CodeImport { | ||
pub name: String, | ||
pub import: String, | ||
pub source: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::domain::code_package::CodePackage; | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone)] | ||
pub struct CodeModule { | ||
pub name: String, | ||
pub path: String, | ||
pub package: Vec<CodePackage>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::domain::code_class::CodeClass; | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone)] | ||
pub struct CodePackage { | ||
pub name: String, | ||
pub path: String, | ||
pub class: Vec<CodeClass>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use code_class::CodeClass; | ||
|
||
pub mod code_import; | ||
pub mod code_file; | ||
pub mod code_package; | ||
pub mod code_module; | ||
pub mod code_class; | ||
pub mod code_function; | ||
pub mod code_annotation; | ||
|
||
impl Location for CodeClass { | ||
fn set_start(&mut self, row: usize, column: usize) { | ||
self.start.row = row; | ||
self.start.column = column; | ||
} | ||
|
||
fn set_end(&mut self, row: usize, column: usize) { | ||
self.end.row = row; | ||
self.end.column = column; | ||
} | ||
} | ||
|
||
pub trait Location { | ||
fn set_start(&mut self, row: usize, column: usize); | ||
fn set_end(&mut self, row: usize, column: usize); | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone)] | ||
pub struct CodePoint { | ||
pub row: usize, | ||
pub column: usize | ||
} | ||
|
||
impl Default for CodePoint { | ||
fn default() -> Self { | ||
CodePoint { | ||
row: 0, | ||
column: 0 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.