diff --git a/docs/language/arrays.md b/docs/language/arrays.md index f8bb8d2..7f66fd8 100644 --- a/docs/language/arrays.md +++ b/docs/language/arrays.md @@ -7,7 +7,7 @@ sidebar_position: 60 In the provided code snippet, we can see how arrays work: ```mew -let foo = string[] { "A", "B", "C" }; +let foo = new string[] { "A", "B", "C" }; let bar = i32[4]; bar[0] = 0; @@ -15,19 +15,19 @@ bar[1] = 1; bar[2] = 2; bar[3] = 3; -let qux = i32[4] { 0, 1, 2, 3 }; +let qux = new i32[4] { 0, 1, 2, 3 }; ``` ### Array initialization ```mew -let foo = string[] { "A", "B", "C" }; +let foo = new string[] { "A", "B", "C" }; ``` This line declares an array of type `string` and initializes it with three string elements "A", "B", and "C". In Mew, arrays can be initialized with values directly using the curly braces syntax. ```mew -let bar = i32[4]; +let bar = new i32[4]; ``` This line declares an array of type `i32`, specifying the size of the array as 4. The array is created, but it is initially empty. @@ -49,7 +49,7 @@ Similarly, this line assigns 1 to the second element at index 1, and so on for t ### Array Initialization with Values ```mew -let qux = i32[4] { 0, 1, 2, 3 }; +let qux = new i32[4] { 0, 1, 2, 3 }; ``` This line declares an array of type `i32` and initializes it with four integer values: 0, 1, 2, and 3. This is another way to create and initialize an array with specific values at the time of declaration. \ No newline at end of file diff --git a/docs/language/functions.md b/docs/language/functions.md index 6b032cc..493592d 100644 --- a/docs/language/functions.md +++ b/docs/language/functions.md @@ -10,16 +10,10 @@ sidebar_position: 70 pub static fn square(value: i32) -> i32 { return value * value; } - -// Static function with optional label -pub static fn log(_ content: any) { - print(content); -} ``` ### Calling functions ```mew -let result = square(value: 32); -log(result); +let result = square(32); ``` \ No newline at end of file diff --git a/docs/language/types.md b/docs/language/types.md index d7b75c1..e08efcb 100644 --- a/docs/language/types.md +++ b/docs/language/types.md @@ -4,8 +4,6 @@ sidebar_position: 80 # Types -_Work in progress_ - ### Fields :::note @@ -20,7 +18,9 @@ pub type Person { ```mew // Usage: -let person = Person(name: "Patrik"); +let person = new Person { + name: "Patrik" +}; ``` ### Methods @@ -37,7 +37,7 @@ pub type Clock { ```mew // Usage: -let clock = Clock(); +let clock = new Clock(); let now = clock.get_current_time(); ``` @@ -75,5 +75,5 @@ pub type Person { ```mew // Usage: -let person = Person::new(name: "Patrik"); +let person = Person::new("Patrik"); ``` \ No newline at end of file diff --git a/src/prism/prism-mew.js b/src/prism/prism-mew.js index 7868435..b0ece9e 100644 --- a/src/prism/prism-mew.js +++ b/src/prism/prism-mew.js @@ -4,7 +4,7 @@ Prism.languages.mew = Prism.languages.extend('clike', { lookbehind: true, greedy: true }, - 'keyword': /\b(?:external|union|where|namespace|match|mut|static|pub|use|type|interface|impl|field|while|loop|break|continue|else|fn|if|return|let|for|in|as|print)\b/, + 'keyword': /\b(?:new|external|union|where|namespace|match|mut|static|pub|use|type|interface|impl|field|while|loop|break|continue|else|fn|if|return|let|for|in|as|print)\b/, 'boolean': /\b(?:_|false|iota|nil|true)\b/, 'number': [ // binary and octal integers