mise en place correctement des commantaires, et permière version des objets Structure et Entree. Plus qu'as modifier parser.rs et buffer.rs pour les tester
This commit is contained in:
parent
da52af342b
commit
f3491fb333
1 changed files with 57 additions and 24 deletions
|
@ -11,29 +11,6 @@ struct Structure {
|
||||||
* - def variable
|
* - def variable
|
||||||
* - def function
|
* - def function
|
||||||
* - pipes
|
* - pipes
|
||||||
*
|
|
||||||
* Cas 1; commande
|
|
||||||
* name: "commande"
|
|
||||||
* contents: ["nom commande", "parametter", "arg1", ...]
|
|
||||||
*
|
|
||||||
* Cas 2; control
|
|
||||||
* name: "control"
|
|
||||||
* contents: ["if|elif|else|while|for", "condition", "liste String avec (faudra la reparser
|
|
||||||
* quand on tomberas dessus pour obtenir son objet de classe Entree) "]
|
|
||||||
*
|
|
||||||
* Cas 3; def variable
|
|
||||||
* name: "variable"
|
|
||||||
* contents: ["type [string|list]", "name", "value"]
|
|
||||||
*
|
|
||||||
* Cas 4; def function
|
|
||||||
* name: "function"
|
|
||||||
* contents: ["name", "nb parametter", "param1", ..., "liste String interieur fonction(faudra
|
|
||||||
* la repasser quand on tomberas dessus pour obtenir son objet de classe Entree)"]
|
|
||||||
*
|
|
||||||
* Cas 5; pipes
|
|
||||||
* name: "pipe"
|
|
||||||
* contents: ["String Commande1 (faudra la repasser dans le parser)", "String Commande2(tout
|
|
||||||
* le reste du pipe faudra le repasser dans le parser)"]
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
name: String,
|
name: String,
|
||||||
|
@ -41,18 +18,68 @@ struct Structure {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Structure {
|
impl Structure {
|
||||||
|
/*
|
||||||
|
* name: "commande"
|
||||||
|
* contents: ["nom commande", "parametter", "arg1", ...]
|
||||||
|
*
|
||||||
|
* parametter define if the command is in background or not. For now, parametter can only be
|
||||||
|
* either "" or "&"
|
||||||
|
*/
|
||||||
fn new_commande(cont: Vec<String>) -> Self {
|
fn new_commande(cont: Vec<String>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
name: String::from("commande"),
|
name: String::from("commande"),
|
||||||
contents: cont,
|
contents: cont,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* name: "control"
|
||||||
|
* contents: ["if|elif|else|while|for", "condition", "liste String avec (faudra la reparser
|
||||||
|
* quand on tomberas dessus pour obtenir son objet de classe Entree) "]
|
||||||
|
*/
|
||||||
fn new_control(cont: Vec<String>) -> Self {
|
fn new_control(cont: Vec<String>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
name: String::from("control"),
|
name: String::from("control"),
|
||||||
contents: cont,
|
contents: cont,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* name: "variable"
|
||||||
|
* contents: ["type [string|list]","parametter", "name", "value"]
|
||||||
|
*
|
||||||
|
* parametter says if the variable is to export or not. right now it's either "" or "export"
|
||||||
|
*/
|
||||||
|
fn new_variable(cont: Vec<String>) -> Self {
|
||||||
|
Self {
|
||||||
|
name: String::from("variable"),
|
||||||
|
contents: cont,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* name: "function"
|
||||||
|
* contents: ["name", "nb parametter", "param1", ..., "liste String interieur fonction(faudra
|
||||||
|
* la repasser quand on tomberas dessus pour obtenir son objet de classe Entree)"]
|
||||||
|
*/
|
||||||
|
fn new_function(cont: Vec<String>) -> Self {
|
||||||
|
Self {
|
||||||
|
name: String::from("variable"),
|
||||||
|
contents: cont,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* name: "pipe"
|
||||||
|
* contents: ["String Commande1 (faudra la repasser dans le parser)", "String Commande2(tout
|
||||||
|
* le reste du pipe faudra le repasser dans le parser)"]
|
||||||
|
*/
|
||||||
|
fn new_pipe(cont: Vec<String>) -> Self {
|
||||||
|
Self {
|
||||||
|
name: String::from("pipe"),
|
||||||
|
contents: cont,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn get_name(&self) -> &String {
|
||||||
|
&self.name
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Entree {
|
struct Entree {
|
||||||
|
@ -64,12 +91,18 @@ struct Entree {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Entree {
|
impl Entree {
|
||||||
fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
size: 0,
|
size: 0,
|
||||||
inputs: Vec::new(),
|
inputs: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn add_structure(&mut self, structure: Structure) -> i8 {
|
||||||
|
self.inputs.push(structure);
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue