Skip to content

Commit

Permalink
fixed some errors with wrendoc
Browse files Browse the repository at this point in the history
  • Loading branch information
dollerama committed Sep 9, 2024
1 parent dd94efd commit 561e76f
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 41 deletions.
30 changes: 15 additions & 15 deletions src/scripts/WrenDocs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ sub create_docv2 {
if(($_ =~ /^\s*foreign/s) != 0) {
if(($_ =~ /class/s) != 0) {
if($verbose) {
print "? foreign class\n";
print " WrenDoc Found: foreign class\n";
}

my $class_inherit = ($_ =~ /(?<=(is\s))(.*)(?=(\s\{))/g)[1];
Expand All @@ -72,12 +72,12 @@ sub create_docv2 {
} else {
if(($_ =~ /^\s*class/s) != 0) {
if($verbose) {
print "? class\n";
print " WrenDoc Found: class\n";
}

my $class_inherit = ($_ =~ /(?<=(is\s))(.*)(?=(\s\{))/g)[1];

if($class_inherit ne "") {
if(!$class_inherit || $class_inherit ne "") {
my $class_name = ($_ =~ /(?<=(class\s))(.*)(?=(\s[is]))/g)[1];
$header .= "### Class ``".$class_name."``\n";
$header .= "> Inherits from ``".$class_inherit."``\n";
Expand All @@ -95,7 +95,7 @@ sub create_docv2 {
if(@beginning != 0) {
if(join("", @beginning) =~ m/=\s?\(/) {
if($verbose) {
print "? static setter\n";
print " WrenDoc Found: static setter\n";
}

my $name = ($_ =~ /(?<=(static\s))(.*)(?=(=\s?\())/s)[1];
Expand All @@ -107,7 +107,7 @@ sub create_docv2 {
$result .= "##### Static Setter ``".$name;
$result .= " = ";
for( $a = 0; $a <= $#param; $a = $a + 1 ) {
if($param_t[$a] eq "") {
if(!@param_t || $param_t[$a] eq "") {
$result .= $param[$a].": _";
} else {
$result .= $param[$a].": ".$param_t[$a];
Expand All @@ -122,7 +122,7 @@ sub create_docv2 {
}
elsif(join("", @beginning) =~ m/\(/) {
if($verbose) {
print "? static method\n";
print " WrenDoc Found: static method\n";
}

my $name = ($_ =~ /(?<=(static\s))(.*)(?=\()/s)[1];
Expand All @@ -132,7 +132,7 @@ sub create_docv2 {
$result .= "##### Static Method ``".$name;
$result .= "(";
for( $a = 0; $a <= $#param; $a = $a + 1 ) {
if($param_t[$a] eq "") {
if(!@param_t || $param_t[$a] eq "") {
$result .= $param[$a].": _";
} else {
$result .= $param[$a].": ".$param_t[$a];
Expand All @@ -146,7 +146,7 @@ sub create_docv2 {
push(@methods, "> - ".$name);
} else {
if($verbose) {
print "? static getter\n";
print " WrenDoc Found: static getter\n";
}
my $name = ($_ =~ /(?<=(static\s))(.*)(?=(\{))/s)[1];
$name =~ s/^\s+|\s+$//g;
Expand All @@ -160,7 +160,7 @@ sub create_docv2 {
}
} elsif(($_ =~ /construct/s) != 0) {
if($verbose) {
print "? constructor\n";
print " WrenDoc Found: constructor\n";
}
my $name = ($_ =~ /(?<=(construct\s))(.*)(?=\()/s)[1];
my @param = split(", ", ($_ =~ /(?<=(\())(.*)(?=(\)))/s)[1]);
Expand All @@ -169,7 +169,7 @@ sub create_docv2 {
$result .= "##### Constructor ``".$name;
$result .= "(";
for( $a = 0; $a <= $#param; $a = $a + 1 ) {
if($param_t[$a] eq "") {
if(!@param_t || $param_t[$a] eq "") {
$result .= $param[$a].": _";
} else {
$result .= $param[$a].": ".$param_t[$a];
Expand All @@ -187,7 +187,7 @@ sub create_docv2 {
if(@beginning != 0) {
if(join("", @beginning) =~ m/=\s?\(/) {
if($verbose) {
print "? setter\n";
print " WrenDoc Found: setter\n";
}
my $name = ($_ =~ /(.*)(?=(=\s?\())/s)[0];
$name =~ s/^\s+|\s+$//g;
Expand All @@ -198,7 +198,7 @@ sub create_docv2 {
$result .= "##### Setter ``".$name;
$result .= " = ";
for( $a = 0; $a <= $#param; $a = $a + 1 ) {
if($param_t[$a] eq "") {
if(!@param_t || $param_t[$a] eq "") {
$result .= $param[$a].": _";
} else {
$result .= $param[$a].": ".$param_t[$a];
Expand All @@ -213,7 +213,7 @@ sub create_docv2 {
}
elsif(join("", @beginning) =~ m/\(/) {
if($verbose) {
print "? method\n";
print " WrenDoc Found: method\n";
}
my $name = ($_ =~ /(.*)(?=\()/s)[0];
$name =~ s/^\s+|\s+$//g;
Expand All @@ -223,7 +223,7 @@ sub create_docv2 {
$result .= "##### Method ``".$name;
$result .= "(";
for( $a = 0; $a <= $#param; $a = $a + 1 ) {
if($param_t[$a] eq "") {
if(!@param_t || $param_t[$a] eq "") {
$result .= $param[$a].": _";
} else {
$result .= $param[$a].": ".$param_t[$a];
Expand All @@ -238,7 +238,7 @@ sub create_docv2 {
}
else {
if($verbose) {
print "? getter\n";
print " WrenDoc Found: getter\n";
}
my $name = ($_ =~ /(.*)(?=(\{))/s)[0];
$name =~ s/^\s+|\s+$//g;
Expand Down
65 changes: 39 additions & 26 deletions src/scripts/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
> - [math](#module---math--)
## Module ``app``
### Classes
> - [GameObjectRef](#gameobjectref)
> - [Lilah](#lilah)
> - [Audio](#audio)
> - [KeycodeLookup](#keycodelookup)
> - [Input](#input)
> - [UI](#ui)
> - [Curve](#curve)
> - [Tween](#tween)
### Class ``GameObjectRef``
> - [](#)
> - [](#)
> - [](#)
> - [](#)
> - [](#)
> - [](#)
> - [](#)
> - [](#)
### Class ````
> Inherits from ````
#### Methods
> - create_ref
> - ref
Expand Down Expand Up @@ -53,7 +54,8 @@
##### Constructor ``new(i: _)``
``return _``

### Class ``Lilah``
### Class ````
> Inherits from ````
#### Methods
> - camera
> - destroy
Expand Down Expand Up @@ -152,7 +154,8 @@
##### Static Method ``find(key: _)``
``return _``

### Class ``Audio``
### Class ````
> Inherits from ````
#### Methods
> - music
> - command
Expand Down Expand Up @@ -201,7 +204,8 @@
##### Static Method ``clear()``
``return _``

### Class ``KeycodeLookup``
### Class ````
> Inherits from ````
#### Methods
> - new
> - W
Expand Down Expand Up @@ -239,7 +243,8 @@
##### Getter ``Left``
``return _``

### Class ``Input``
### Class ````
> Inherits from ````
#### Methods
> - mouse_pos
> - Keycode
Expand Down Expand Up @@ -309,7 +314,8 @@
##### Static Method ``binding2D(bind1: _, bind2: _)``
``return _``

### Class ``UI``
### Class ````
> Inherits from ````
#### Methods
> - on_click_callbacks
> - on_click_down_callbacks
Expand Down Expand Up @@ -339,7 +345,8 @@
##### Static Method ``tick()``
``return _``

### Class ``Curve``
### Class ````
> Inherits from ````
#### Methods
> - linear
> - inQuad
Expand Down Expand Up @@ -393,7 +400,8 @@
##### Static Getter ``inOutElastic``
``return _``

### Class ``Tween``
### Class ````
> Inherits from ````
#### Methods
> - tweens
> - tweens
Expand Down Expand Up @@ -472,14 +480,15 @@
## Module ``io``
### Classes
> - [Fs](#fs)
> - [Serializable](#serializable)
> - [Json](#json)
> - [JsonStringify](#jsonstringify)
> - [JsonParser](#jsonparser)
> - [](#)
> - [](#)
> - [](#)
> - [](#)
### Foreign Class ``Fs``
#### Methods

### Class ``Serializable``
### Class ````
> Inherits from ````
#### Methods
> - wrapperFn
> - wrapper
Expand Down Expand Up @@ -509,7 +518,8 @@
##### Static Method ``iterProperties(t: _)``
``return _``

### Class ``Json``
### Class ````
> Inherits from ````
#### Methods
> - parse(string) { parse
> - parse
Expand All @@ -531,7 +541,8 @@
##### Static Method ``stringify(value: _, whitespace: _, callback: _)``
``return _``

### Class ``JsonStringify``
### Class ````
> Inherits from ````
#### Methods
> - stringify
> - stringify_map
Expand All @@ -553,7 +564,8 @@
##### Static Method ``stringify_value(value: _, whitespace: _, depth: _, out: _)``
``return _``

### Class ``JsonParser``
### Class ````
> Inherits from ````
#### Methods
> - root
> - new
Expand Down Expand Up @@ -645,9 +657,10 @@

## Module ``math``
### Classes
> - [Util](#util)
> - [](#)
> - [Vec2](#vec2)
### Class ``Util``
### Class ````
> Inherits from ````
#### Methods
> - lerp
##### Static Method ``lerp(a: _, b: _, t: _)``
Expand Down

0 comments on commit 561e76f

Please sign in to comment.