Skip to content

Commit

Permalink
okay
Browse files Browse the repository at this point in the history
  • Loading branch information
DEntisT committed Aug 29, 2023
1 parent 2851c8a commit 077d15c
Show file tree
Hide file tree
Showing 16 changed files with 124 additions and 23 deletions.
10 changes: 5 additions & 5 deletions doc/objclass.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Object-oriented Programming

- 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.
- 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;
Expand All @@ -9,12 +9,12 @@ class TestClass;
new.double,TestClassDouble=364.234;
}

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

object,TestObj2=TestClass;
object TestObj2=TestClass;
TestObj2.ClassTestVar=9376216;
TestObj2.TestClassDouble=314.159267243;
console.cout.log(TestObj2.ClassTestVar);
Expand All @@ -28,7 +28,7 @@ class TestClass2;
new.bool,TestClassBool=false;
}

object,TestObj3=TestClass2;
object TestObj3=TestClass2;
console.cout.log(TestObj3.ClassTestVar);
console.cout.log(TestObj3.TestClassDouble);
console.println.log("#3 {TestObj3.ClassTestVar} & {TestObj3.TestClassDouble} & {TestObj3.TestClassBool}");
Expand Down Expand Up @@ -58,7 +58,7 @@ namespace testnamespace
}
}

object,Obj=testnamespace::testclass
object Obj=testnamespace::testclass
Obj.testinteger=13
std::writeln("{Obj.testinteger}")
```
Expand Down
8 changes: 4 additions & 4 deletions doc/tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- Assigning a `MyTag` tag to a variable.

```cpp
tag,MyTag;
tag MyTag
MyTag<-new.int,testvar=10;
```

Expand All @@ -16,9 +16,9 @@ MyTag<-new.int,testvar=10;
- Tags inside namespaces.

```cpp
namespace,TagTestNameSpace;
namespace TagTestNameSpace
{
tag,MyTag;
tag MyTag
}

TagTestNameSpace::MyTag<-new.int,testvar=1;
Expand All @@ -29,7 +29,7 @@ TagTestNameSpace::MyTag<-new.int,testvar=1;
- Since tags serve as little marks you can mark your special variables with, `tagof` instruction can be used to check if specific data is marked with a specific tag.

```cpp
tag,MyNewTag;
tag MyNewTag;
MyNewTag<-new.int,tagtestinteger=1;
if.equ,tagof?tagtestinteger,MyNewTag->console.println.log("tagtestinteger has the MyNewTag!");
```
Expand Down
Binary file modified scriptfiles/index.ps
Binary file not shown.
Binary file modified scriptfiles/modules/args.ps
Binary file not shown.
Binary file modified scriptfiles/modules/data.ps
Binary file not shown.
Binary file modified scriptfiles/modules/discord.ps
Binary file not shown.
Binary file modified scriptfiles/modules/emit.ps
Binary file not shown.
Binary file modified scriptfiles/modules/enum.ps
Binary file not shown.
Binary file modified scriptfiles/modules/inline.ps
Binary file not shown.
Binary file modified scriptfiles/modules/pawn.ps
Binary file not shown.
Binary file modified scriptfiles/modules/stdlib.ps
Binary file not shown.
Binary file modified scriptfiles/modules/vector.ps
Binary file not shown.
6 changes: 3 additions & 3 deletions src/components/vector.inc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ the Initial Developer. All Rights Reserved.
forward dpp_processvector(funcgroup[][],args[][],args_const[][]);
public dpp_processvector(funcgroup[][],args[][],args_const[][])
{
if(!strcmp(funcgroup[0], "vector"))
if(!strcmp(funcgroup[0], "vec"))
{
if(dpp_config[vector_comp] == 0)
{
dpp_error("Component \"vector\" is not imported.",);
dpp_error("Component \"vec\" is not imported.",);
dpp_internal<return>(0);
}
// If the function used it "print"
Expand All @@ -41,7 +41,7 @@ public dpp_processvector(funcgroup[][],args[][],args_const[][])
}
else
{
dpp_error("Unknown form in the component \"vector\".",);
dpp_error("Unknown form in the component \"vec\".",);
dpp_internal<return>(0);
}
}
Expand Down
15 changes: 5 additions & 10 deletions src/modules/interpreter.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1194,10 +1194,10 @@ stock dpp_process(line[])
return 1;
}

if(!strcmp(funcgroup[0], "object"))
if(!strcmp(tokengroup[0], "object"))
{
new address[2][dpp_maxsymbolchar];
dpp_parseline(args[1], address, '=');
dpp_parseline(tokengroup[1], address, '=');
dpp_createobject(address[0],address[1]);
return 1;
}
Expand Down Expand Up @@ -1930,14 +1930,9 @@ stock dpp_process(line[])
////
///////////////////////////////////////////////////////

if(!strcmp(funcgroup[0], "tag"))
if(!strcmp(tokengroup[0], "tag"))
{
if(isnull(args[1]))
{
dpp_error("Invalid expression.",);
return 1;
}
dpp_createtag(args[1]);
dpp_createtag(tokengroup[1]);
return 1;
}

Expand Down Expand Up @@ -2910,7 +2905,7 @@ stock dpp_process(line[])
dpp_config[iter_comp] = 1;
return 1;
}
if(!strcmp(tokengroup[1], "vector"))
if(!strcmp(tokengroup[1], "vec"))
{
dpp_config[vector_comp] = 1;
return 1;
Expand Down
5 changes: 4 additions & 1 deletion src/ps_mem.pwn
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,12 @@ new dpp_stkreg[DPP_STKSIZE][dpp_maxsymbolchar];
new dpp_allowcollision;
#define @emit__%0\32;%1\10;%3 dpp_asm__(%1);
//-----------------------------------------------------------
#define dpp_maxkwords 54
#define dpp_maxkwords 57
new dpp_kwords[dpp_maxkwords][256] = {
"public",
"default",
"enum",
"class",
"inline",
"namespace",
"constexpr",
Expand Down
103 changes: 103 additions & 0 deletions st3/syntax.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
file_extensions:
- .ps
scope: source.example-c
contexts:
main:
# Strings begin and end with quotes, and use backslashes as an escape
# character
- match: '"'
scope: punctuation.definition.string.begin.example-c
push: double_quoted_string

- match: "'"
scope: punctuation.definition.string.begin.example-c
push: single_quoted_string

# Comments begin with a '//' and finish at the end of the line
- match: '//'
scope: punctuation.definition.comment.example-c
push: line_comment
# Keywords are if, else for and while.
# Note that blackslashes don't need to be escaped within single quoted
# strings in YAML. When using single quoted strings, only single quotes
# need to be escaped: this is done by using two single quotes next to each
# other.
- match: '\b(enum|class|public|inline|namespace|constexpr|const|static|new|int|bool|str|double|char|void|using|return|hook|method|task|for|foreach|while|do|try|object|tag|break|continue|template|typedef|exit|user|if|else|tagof|sizeof|addressof|short|unsigned|include|undef|pragma|emit|defined|iterator|vector|export|import|this|interval|repeat)\b'
scope: keyword.control.example-c

# Numbers
- match: '\b(-)?[0-9.@#]+\b'
scope: constant.numeric.example-c

- match: '\b(true|false|default)\b'
scope: constant.numeric.example-c

- match: '[@#]'
scope: constant.numeric.example-c

- match: '::'
scope: constant.numeric.example-c

- match: '->'
scope: keyword.control.example-c

- match: '<-'
scope: keyword.control.example-c

- match: '\?'
scope: keyword.control.example-c

- match: '\b(console|system|pawn|data|vec|iter|files|math|misc)\b'
scope: constant.numeric.example-c

- match: '[\w]+\('
scope: entity.name.impl.example-c
- match: '\)'
scope: entity.name.impl.example-c

- match: '\b(void|int|bool|str|double|char)\b'
scope: keyword.control.example-c
push:
- function
- function-name

double_quoted_string:
- meta_scope: string.quoted.double.example-c
- match: '\\.'
scope: constant.character.escape.example-c
- match: '"'
scope: punctuation.definition.string.end.example-c
pop: true

single_quoted_string:
- meta_scope: string.quoted.double.example-c
- match: '\\.'
scope: constant.character.escape.example-c
- match: "'"
scope: punctuation.definition.string.end.example-c
pop: true

line_comment:
- meta_scope: comment.line.example-c
- match: $
pop: true

function:
- meta_scope: meta.function

function-name:
- match: '[a-zA-Z0-9_]+'
scope: variable.function
- match: \(
scope: punctuation.section.group.begin
set: function-params

function-params:
- meta_scope: meta.function.params
- clear_scopes: 1
- match: \)
scope: punctuation.section.group.end
pop: 2

0 comments on commit 077d15c

Please sign in to comment.