aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2021-04-23 23:22:48 +0200
committerDaniel Gavin <danielgavin5@hotmail.com>2021-04-23 23:22:48 +0200
commit5fba548aa032ada33fce0ba0dc6ca0876e0fceb1 (patch)
treecd305d15735e2b420ae3a9ca24bff53871619011
parentaafbf5bac7b6aec6a1a11a6ac48d064319432891 (diff)
more fixes with wierd comment placements
-rw-r--r--core/odin/printer/printer.odin12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/odin/printer/printer.odin b/core/odin/printer/printer.odin
index 1ee7d7a62..13c8dbf6b 100644
--- a/core/odin/printer/printer.odin
+++ b/core/odin/printer/printer.odin
@@ -12,6 +12,9 @@ Type_Enum :: enum {Line_Comment, Value_Decl, Switch_Stmt, Struct, Assign, Call,
Line_Type :: bit_set[Type_Enum];
+/*
+ Represents an unwrapped line
+*/
Line :: struct {
format_tokens: [dynamic]Format_Token,
finalized: bool,
@@ -20,6 +23,9 @@ Line :: struct {
types: Line_Type, //for performance, so you don't have to verify what types are in it by going through the tokens - might give problems when adding linebreaking
}
+/*
+ Represents an singular token in a unwrapped line
+*/
Format_Token :: struct {
kind: tokenizer.Token_Kind,
text: string,
@@ -474,12 +480,12 @@ align_var_decls :: proc(p: ^Printer) {
not_mutable := false;
continue_flag := false;
- for i := 0; i < len(line.format_tokens) - 1; i += 1 {
- if line.format_tokens[i].kind == .Colon && line.format_tokens[i + 1].kind == .Eq {
+ for i := 0; i < len(line.format_tokens); i += 1 {
+ if line.format_tokens[i].kind == .Colon && line.format_tokens[min(i + 1, len(line.format_tokens) - 1)].kind == .Eq {
typed = false;
}
- if line.format_tokens[i].kind == .Colon && line.format_tokens[i + 1].kind == .Colon {
+ if line.format_tokens[i].kind == .Colon && line.format_tokens[min(i + 1, len(line.format_tokens) - 1)].kind == .Colon {
not_mutable = true;
}