diff --git a/source/fnc/treegen/ast_types.d b/source/fnc/treegen/ast_types.d index 6f73bfe..249a5df 100644 --- a/source/fnc/treegen/ast_types.d +++ b/source/fnc/treegen/ast_types.d @@ -88,12 +88,12 @@ enum OperationVariety { Pipe, Assignment, - BitwiseNot, + Concatenate, BitwiseOr, BitwiseXor, BitwiseAnd, - BitwiseNotEq, + ConcatenateEq, BitwiseOrEq, BitwiseXorEq, BitwiseAndEq, @@ -274,6 +274,10 @@ class AstNode { printTabs(); switch (action) { + case AstAction.Voidable: + writeln(action); + voidableType.tree(tabCount + 1); + break; case AstAction.GenericOf: write(action); writeln(":"); diff --git a/source/fnc/treegen/relationships.d b/source/fnc/treegen/relationships.d index 9095b0c..30ed053 100644 --- a/source/fnc/treegen/relationships.d +++ b/source/fnc/treegen/relationships.d @@ -709,9 +709,9 @@ const OperatorPrecedenceLayer[] operatorPrecedence = [ ]), OperationPrecedenceEntry(OperationVariety.LogicalNot, [ - OPR('!'), Token(TokenType.Filler) + Token(TokenType.ExclamationMark, "!".makeUnicodeString), Token(TokenType.Filler) ]), - OperationPrecedenceEntry(OperationVariety.BitwiseNot, [ + OperationPrecedenceEntry(OperationVariety.Concatenate, [ OPR('~'), Token(TokenType.Filler) ]), ]), @@ -849,7 +849,7 @@ const OperatorPrecedenceLayer[] operatorPrecedence = [ Token(TokenType.Filler), OPR('|'), OPR('='), Token(TokenType.Filler) ]), - OperationPrecedenceEntry(OperationVariety.BitwiseNotEq, [ + OperationPrecedenceEntry(OperationVariety.ConcatenateEq, [ Token(TokenType.Filler), OPR('~'), OPR('='), Token(TokenType.Filler) ]), @@ -896,6 +896,7 @@ bool testAndJoin(const(OperationPrecedenceEntry) entry, ref Array!AstNode nodes, operands ~= node; break; case TokenType.QuestionMark: + case TokenType.ExclamationMark: case TokenType.Equals: case TokenType.Operator: if (node.action != AstAction.TokenHolder) @@ -903,7 +904,8 @@ bool testAndJoin(const(OperationPrecedenceEntry) entry, ref Array!AstNode nodes, Token token = node.tokenBeingHeld; if (token.tokenVariety != TokenType.Equals && token.tokenVariety != TokenType.Operator - && token.tokenVariety != TokenType.QuestionMark) + && token.tokenVariety != TokenType.QuestionMark + && token.tokenVariety != TokenType.ExclamationMark) return false; if (token.value != entry.tokens[index].value) return false; diff --git a/source/main.d b/source/main.d index 08fae6b..7fce39b 100644 --- a/source/main.d +++ b/source/main.d @@ -45,16 +45,21 @@ public enum GenerationFlags { Common, Native, // Remaining features may be toggled, sourced from gallinule ID enums (not CR) } +import fnc.tokenizer.make_tokens; +import fnc.treegen.scope_parser; +import fnc.treegen.expression_parser; +import fnc.treegen.relationships; void main() { - import fnc.treegen.scope_parser : parseMultilineScope, ScopeData, tree; - import fnc.treegen.relationships : GLOBAL_SCOPE_PARSE; + ScopeData globalScope = parseMultilineScope(GLOBAL_SCOPE_PARSE, " public module foo.bar; int main(){ - byte c = (1 + 5 )|> B.c; + !false; + } "); + globalScope.tree; } \ No newline at end of file