-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Callisto compiler style guide | ||
|
||
## Function calls | ||
This is how a function call must be formatted: | ||
``` | ||
myfunc(arg1, arg2); | ||
``` | ||
- no space between the name and the ( | ||
- space after commas | ||
|
||
## Import structure | ||
#### Order of imports | ||
1. standard libraryes | ||
2. 3rd party libraries | ||
4. imports from this project | ||
|
||
Imports must be ordered based on the length of the text | ||
|
||
## Pointer definitions | ||
``` | ||
int* b; | ||
``` | ||
The pointer must be on the left side | ||
|
||
## Statements | ||
``` | ||
if (...) { | ||
} | ||
else { | ||
} | ||
``` | ||
- } must be on a line on its own | ||
- { must be on the line with the statement | ||
|
||
If the body has one statement, format like this: | ||
``` | ||
if (...) body | ||
``` | ||
|
||
## Naming | ||
- camelCase for variables | ||
- PascalCase for functions | ||
- PascalCase for classes/structs/enums/aliases etc | ||
- camelCase for module names | ||
|
||
## Function definitions | ||
``` | ||
void myfunc() { | ||
} | ||
``` | ||
|
||
or | ||
``` | ||
void myfunc() => ...; | ||
``` | ||
|
||
or | ||
``` | ||
void myfunc() => | ||
...; | ||
``` | ||
|
||
## Comments | ||
- use `//` for single line comments | ||
|
||
## Line length | ||
- Limited to 85 characters | ||
- If lines are too long with paranthesis, split like this: | ||
``` | ||
... ( | ||
... | ||
) | ||
... | ||
``` |