-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some pointer deletion not running destructors
- Loading branch information
1 parent
17deeac
commit 25b312d
Showing
9 changed files
with
194 additions
and
159 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
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
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
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,20 @@ | ||
#ifndef DIANNEX_PARSERESULT_H | ||
#define DIANNEX_PARSERESULT_H | ||
|
||
#include <vector> | ||
|
||
namespace diannex | ||
{ | ||
struct ParseResult | ||
{ | ||
class Node* baseNode; | ||
std::vector<struct ParseError> errors; | ||
bool doDelete = true; | ||
|
||
~ParseResult(); | ||
|
||
ParseResult(const ParseResult&) = delete; | ||
}; | ||
} | ||
|
||
#endif |
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
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,136 @@ | ||
#ifndef DIANNEX_TOKEN_H | ||
#define DIANNEX_TOKEN_H | ||
|
||
#include <string> | ||
|
||
namespace diannex | ||
{ | ||
enum TokenType | ||
{ | ||
Identifier, // a-z, A-Z, other language chars, _ (and 0-9 or . after first char) | ||
Number, // 0-9 first chars, optional . followed by more 0-9 | ||
Percentage, // % | ||
String, // " followed by content, ending with unescaped " (no backslash preceding it) (also some other escape codes) | ||
MarkedString, // @" and then continue like String | ||
ExcludeString, // !" and then continue like String | ||
|
||
GroupKeyword, // These are reserved identifiers, documented in below enum | ||
MainKeyword, | ||
MainSubKeyword, | ||
ModifierKeyword, | ||
|
||
OpenParen, // ( | ||
CloseParen, // ) | ||
OpenCurly, // { | ||
CloseCurly, // } | ||
OpenBrack, // [ | ||
CloseBrack, // ] | ||
Semicolon, // ; | ||
Colon, // : | ||
Comma, // , | ||
Ternary, // ? | ||
|
||
VariableStart, // $ | ||
|
||
Newline, // Used contextually as a semicolon at the end of statements | ||
|
||
Equals, // = | ||
Plus, // + | ||
Increment, // ++ | ||
PlusEquals, // += | ||
Minus, // - | ||
Decrement, // -- | ||
MinusEquals, // -= | ||
Multiply, // * | ||
Power, // ** | ||
MultiplyEquals, // *= | ||
Divide, // / | ||
DivideEquals, // /= | ||
Mod, // % | ||
ModEquals, // %= | ||
Not, // ! | ||
|
||
CompareEQ, // == | ||
CompareGT, // > | ||
CompareLT, // < | ||
CompareGTE, // >= | ||
CompareLTE, // <= | ||
CompareNEQ, // != | ||
|
||
LogicalAnd, // && | ||
LogicalOr, // || | ||
|
||
BitwiseLShift, // << | ||
BitwiseRShift, // >> | ||
BitwiseAnd, // & | ||
BitwiseAndEquals, // &= | ||
BitwiseOr, // | | ||
BitwiseOrEquals, // |= | ||
BitwiseXor, // ^ | ||
BitwiseXorEquals, // ^= | ||
BitwiseNegate, // ~ | ||
|
||
Directive, // # | ||
|
||
MarkedComment, // "//*" or "/**" followed by comment, latter closed with normal "*/" | ||
|
||
Error, // If no token matches for some reason OR an error value in the parser | ||
ErrorString, // If there's an error token, but we want to give the token string in the message | ||
ErrorUnenclosedString, // If there's a string with no end | ||
}; | ||
|
||
enum KeywordType | ||
{ | ||
None, | ||
|
||
// Group scope (highest level) | ||
Namespace, | ||
Scene, | ||
Def, | ||
Func, | ||
|
||
// Main scope (scene/function-scope) | ||
Choice, | ||
Choose, | ||
If, | ||
Else, | ||
While, | ||
For, | ||
Do, | ||
Repeat, | ||
Switch, | ||
Continue, | ||
Break, | ||
Return, | ||
Case, | ||
Default, | ||
|
||
// Choice/choose scope | ||
Require, | ||
|
||
// Modifiers (in either scope) | ||
Local, | ||
Global, | ||
|
||
// Directive keywords | ||
Include, | ||
IfDef, | ||
IfNDef, | ||
EndIf | ||
}; | ||
|
||
struct Token | ||
{ | ||
TokenType type; | ||
uint32_t line; | ||
uint16_t column; | ||
KeywordType keywordType; | ||
std::string content; // unused if KeywordType is known | ||
|
||
Token(TokenType type, uint32_t line, uint16_t column); | ||
Token(TokenType type, uint32_t line, uint16_t column, KeywordType keywordType); | ||
Token(TokenType type, uint32_t line, uint16_t column, std::string content); | ||
}; | ||
} | ||
|
||
#endif // DIANNEX_TOKEN_H |
Oops, something went wrong.