started work
This commit is contained in:
parent
f174ec9927
commit
9fa7ed1dcf
6 changed files with 85 additions and 52 deletions
25
sm-test-files/actual-testing/io.sm
Normal file
25
sm-test-files/actual-testing/io.sm
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
&& line comment test
|
||||
|
||||
¡<= /"Hello world!"\!
|
||||
|
||||
¡<= ]] inline comment example [[ /"inline cmmnts work"\!
|
||||
|
||||
``
|
||||
big ass block comment!
|
||||
ye boiiiii
|
||||
´´
|
||||
|
||||
&& declare variable out as string
|
||||
¡}}string{{ out!
|
||||
|
||||
&& take input and take it into var
|
||||
¡=> /out\!
|
||||
|
||||
&& log out
|
||||
¡<= /out\!
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
&& ¡! around code means its a statement
|
||||
&& ¿? around code means its an expression
|
||||
|
||||
#mult /}}string{{str\ /{float}num\ | (
|
||||
¿string * float?
|
||||
)
|
||||
|
@ -8,14 +11,7 @@
|
|||
|
||||
``
|
||||
multiline comment
|
||||
indention example (comments have to be indented as well, btw):
|
||||
first level
|
||||
second level
|
||||
third level
|
||||
fourth level
|
||||
fifth level
|
||||
sixth level
|
||||
|
||||
indention is 3 spaces
|
||||
main function has to be a thing
|
||||
´´
|
||||
|
||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -1,18 +1,16 @@
|
|||
use std::env;
|
||||
use std::fs;
|
||||
|
||||
mod preprocessor;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
let file = fs::read_to_string(&args[1]).expect("Couldnt read file:");
|
||||
println!("{:?}", multiply_strings(file, 3.5));
|
||||
|
||||
println!("{:?}", preprocessor::preprocess(file));
|
||||
}
|
||||
|
||||
fn multiply_strings(str: String, multiplier: f32) -> String {
|
||||
let mut r: String = String::from(str);
|
||||
let rest = multiplier - (multiplier as i32) as f32;
|
||||
let slice = &r.clone()[0..(r.len() as f32 * rest) as usize];
|
||||
fn parse_and_interpret(code: String) {
|
||||
|
||||
r = r.repeat(multiplier as usize);
|
||||
r += slice;
|
||||
r
|
||||
}
|
||||
|
||||
|
|
5
src/preprocessor.rs
Normal file
5
src/preprocessor.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
pub fn preprocess(raw_code: String) -> String {
|
||||
let lines = raw_code.split(' ');
|
||||
for &line in lines {
|
||||
}
|
||||
}
|
9
src/string_math.rs
Normal file
9
src/string_math.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
fn multiply_strings(str: String, multiplier: f32) -> String {
|
||||
let mut r: String = String::from(str);
|
||||
let rest = multiplier - (multiplier as i32) as f32;
|
||||
let slice = &r.clone()[0..(r.len() as f32 * rest) as usize];
|
||||
|
||||
r = r.repeat(multiplier as usize);
|
||||
r += slice;
|
||||
r
|
||||
}
|
Loading…
Reference in a new issue