Skip to content

Commit

Permalink
switching to new syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
DEntis-T committed Jun 24, 2024
1 parent e81326e commit 1f245bf
Show file tree
Hide file tree
Showing 34 changed files with 420 additions and 328 deletions.
6 changes: 4 additions & 2 deletions doc/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,12 @@ files.createdir("MyNewDirAgain")
- Called when the code gets executed.

```cpp
extern&struct*public.main;
@extern
this->struct=default
int main() public
{
console.println("Hello World from main");
return.int,1;
return int 1
}
```

Expand Down
16 changes: 8 additions & 8 deletions doc/const.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
- You also may make constants in PawnScript:

```cpp
const*new.int,MY_FIRST_CONST=1
const[int]MY_FIRST_CONST=1
```


You also may create boolean and string constants:

```cpp
const*new.bool,MY_FIRST_CONST=true
const[bool]MY_FIRST_CONST=true

const*new.str,MY_FIRST_CONST="string"
const[str]MY_FIRST_CONST="string"
```

## Data types
Expand All @@ -23,37 +23,37 @@ const*new.str,MY_FIRST_CONST="string"
- Integers are whole numbers.

```cpp
const*new.int,integer=1
const[int]integer=27
```

### `bool`

- Booleans are variables that can either be true or false.

```cpp
const*new.bool,boolean=true
const[bool]boolean=false
```

### `str`

- Strings are words or sequences of characters.

```cpp
const*new.str,string="test"
const[str]string="Some text"
```

### `double`

- Doubles are numbers with decimal points.

```cpp
const*new.double,decimal_point=3.14
const[double]decimal=45.3
```

### `char`

- Single characters.

```cpp
const*new.char,character='6'
const[char]character='z'
```
2 changes: 1 addition & 1 deletion doc/for.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ For loop id 10
int ForTest2(num) public
{
console.println("'num' is {num@ForTest2}")
return,1
return 1
}

forlooptestvar=0
Expand Down
12 changes: 6 additions & 6 deletions doc/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ You also may return values.
str funcname() public
{
console.println("my first user functions")
static*new.str,return_str="this was returned"
static[str]return_str="this was returned"
return return_str
}
```
Expand All @@ -46,7 +46,7 @@ Then you can use this user function as an argument in a native function.
str funcname() public
{
console.println("my first user functions")
static*new.str,return_str="this was returned"
static[str]return_str="this was returned"
return return_str
}

Expand All @@ -65,7 +65,7 @@ user.funcname()
- You may also use variables and constants as arguments in native functions.

```cpp
const*new.str,CONST_NAME="constant worked"
const[str]CONST_NAME="constant worked"

console.println(CONST_NAME)
```
Expand All @@ -79,21 +79,21 @@ console.println(CONST_NAME)
int functobehooked() public
{
console.println("HOOKED")
return,1
return 1
}

@hook
int functobehooked() public
{
console.println("HOOKED 1")
return.int,1
return int 1
}

@hook
int functobehooked() public
{
console.println("HOOKED 2")
return.int,1
return int 1
}

user.functobehooked()
Expand Down
18 changes: 9 additions & 9 deletions doc/misc.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
Use this to terminate the interpreter, after it was terminated, you'll need to restart the interpreter to run the code again.

```pawn
exit;
exit
```

## String formatting
- You can format any string argument in any form.

```cpp
new.str,test="Test string";
new.str,test="Test string"

console.println("{test}");
console.println("{test}")
```

Output:
Expand All @@ -23,12 +23,12 @@ Test string
```

```cpp
void testfunction(message) public;
void testfunction(message) public
{
console.println(message@testfunction);
console.println(message@testfunction)
}

user.testfunction("{test}");
user.testfunction("{test}")
```
Output:
Expand All @@ -39,10 +39,10 @@ Test string
## `defined` instruction
```cpp
new.int,variable=1;
new.int,variable=1
if.equ,defined?variable,1->console.println("'variable' is defined!");
if.equ,defined?dummyvar,1->console.println("This should not be printed!!");
if.equ,defined?variable,1->console.println("'variable' is defined!")
if.equ,defined?dummyvar,1->console.println("This should not be printed!!")
```

Output:
Expand Down
2 changes: 1 addition & 1 deletion doc/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Afterwards you may import your module:
```cpp
#include:module_name;
#include:module_name
```

Make sure not to add the `*.ps` extension to the `module_name`.
16 changes: 8 additions & 8 deletions doc/namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Within the class code block, we can create a variable.
```cpp
namespace customer
{
new.str,name="Alex";
new.str,name="Alex"
}
```

To use this variable, we need to include the class name within the variable name; like this:

```cpp
console.println(customer::name);
console.println(customer::name)
```

---------------------------------------------------------------------------------------------------------
Expand All @@ -35,10 +35,10 @@ console.println(customer::name);
```cpp
namespace customer
{
new.str,name="Alex";
new.str,name="Alex"
}

console.println(customer::name);
console.println(customer::name)

```

Expand All @@ -47,15 +47,15 @@ We can hook the `customer` namespace:
```cpp
namespace customer
{
new.str,name="Alex";
new.str,name="Alex"
}

console.println(customer::name);
console.println(customer::name)

using namespace customer
{
new.int,age=12;
new.int,age=12
}

console.cout(customer::age);
console.cout(customer::age)
```
42 changes: 21 additions & 21 deletions doc/objclass.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@
- Object-oriented programming (OOP) is a computer programming model that organizes software design around classes and objects. Classes are certain blocks of code, containing elements that can be accessed only via a certain object. After declaring an object object drags elements from the class and creates its own copies, allowing same variable names, but with different values.

```cpp
class TestClass;
class TestClass
{
new.int,ClassTestVar=827346;
new.double,TestClassDouble=364.234;
new.int,ClassTestVar=827346
new.double,TestClassDouble=364.234
}

object TestObj=TestClass;
console.cout.log(TestObj.ClassTestVar);
console.cout.log(TestObj.TestClassDouble);
console.println.log("#1 {TestObj.ClassTestVar} & {TestObj.TestClassDouble}");
object TestObj=TestClass
console.cout.log(TestObj.ClassTestVar)
console.cout.log(TestObj.TestClassDouble)
console.println.log("#1 {TestObj.ClassTestVar} & {TestObj.TestClassDouble}")

object TestObj2=TestClass;
TestObj2.ClassTestVar=9376216;
TestObj2.TestClassDouble=314.159267243;
console.cout.log(TestObj2.ClassTestVar);
console.cout.log(TestObj2.TestClassDouble);
console.println.log("#2 {TestObj2.ClassTestVar} & {TestObj2.TestClassDouble}");
object TestObj2=TestClass
TestObj2.ClassTestVar=9376216
TestObj2.TestClassDouble=314.159267243
console.cout.log(TestObj2.ClassTestVar)
console.cout.log(TestObj2.TestClassDouble)
console.println.log("#2 {TestObj2.ClassTestVar} & {TestObj2.TestClassDouble}")

class TestClass2;
class TestClass2
{
new.int,ClassTestVar=100000;
new.double,TestClassDouble=21.7636;
new.bool,TestClassBool=false;
new.int,ClassTestVar=100000
new.double,TestClassDouble=21.7636
new.bool,TestClassBool=false
}

object TestObj3=TestClass2;
console.cout.log(TestObj3.ClassTestVar);
console.cout.log(TestObj3.TestClassDouble);
console.println.log("#3 {TestObj3.ClassTestVar} & {TestObj3.TestClassDouble} & {TestObj3.TestClassBool}");
object TestObj3=TestClass2
console.cout.log(TestObj3.ClassTestVar)
console.cout.log(TestObj3.TestClassDouble)
console.println.log("#3 {TestObj3.ClassTestVar} & {TestObj3.TestClassDouble} & {TestObj3.TestClassBool}")
```
Output:
Expand Down
Loading

0 comments on commit 1f245bf

Please sign in to comment.