Skip to content

Commit d8ef1a6

Browse files
author
Diego Contreras
committed
MAJOR: Function definitions are now scanned
1 parent f627fc2 commit d8ef1a6

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ RobotCDocs is a tool developed for the purpose of attaching descriptions to user
1313

1414
## What it can do
1515
### Scan / Parse Files
16-
RobotCDocs recursively searches for any header (.h) or source (.c) files in a directory. Each file will be scanned for comments detailing a _declaration_ of a function or variable, like so:
16+
RobotCDocs recursively searches for any header (.h) or source (.c) files in a directory. Each file will be scanned for comments detailing a _declaration_ or _definition_ of a function or variable, like so:
1717

1818
FooLibrary / Foo.h -
1919

2020
/*
2121
* This function does some really cool stuff!
2222
* This sentence will be added to the ladder.
2323
*/
24-
void Foo();
24+
void Foo() {
25+
... code ...
26+
}
2527

2628
/*
2729
* This function does some really cool stuff!
@@ -33,11 +35,16 @@ RobotCDocs recursively searches for any header (.h) or source (.c) files in a di
3335
* A very cool variable!
3436
*/
3537
bool testVariable;
38+
39+
/*
40+
* The second cool variable!
41+
*/
42+
bool testVariable2 = false; // Will not look nice; Initialization is not supported.
3643

3744
![Preview Image](/Images/Foo_Image.png)
3845

3946
### Custom Naming Schemes
40-
By default, the documentation of a declaration will be listed under its file's name. This is seen in the above example, where Foo(parameter) is listed under the _Foo_ category. You can change the category of a declaration with the addition of `@`. In the code below, the addition of `@setup` means that the declaration will be listed under _Setup_, no matter what file it's in. As you can see, `setup` is automatically capitalized to `Setup`.
47+
By default, the documentation of a function or variable will be listed under its file's name. This is seen in the above example, where Foo(parameter) is listed under the _Foo_ category. You can change the category of a function or variable with the addition of `@`. In the code below, the addition of `@setup` means that the declaration will be listed under _Setup_, no matter what file it's in. As you can see, `setup` is automatically capitalized to `Setup`.
4148

4249
FooLibrary / Foo.h -
4350

RobotCDocs/FileScanner.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@ def Parse(self):
8282

8383

8484
if '*/' in line:
85-
# Check that the comment was right before a function or variable declaration.
85+
# Check that the comment was right before a function or variable declaration or definition.
8686
doc.declaration = self.GetNextLine().strip()
87-
if ';' in doc.declaration:
87+
if ';' in doc.declaration or '{' in doc.declaration:
88+
doc.declaration = doc.declaration.replace(";", "").replace("{", "")
8889
self.docs.append(doc)
8990
else:
90-
print('FileScanner.py: Warning: Line %s of %s was skipped due to missing a declaration.' % (self.currentLine + 1, self.docFileName))
91+
print('FileScanner.py: Warning: Line %s of %s was skipped due to missing a declaration or definition.' % (self.currentLine + 1, self.docFileName))
9192

9293
doc = Doc()
9394
doc.category = self.categoryName

0 commit comments

Comments
 (0)