mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
work on comments
This commit is contained in:
@@ -233,7 +233,7 @@ align_comments :: proc(p: ^Printer) {
|
|||||||
|
|
||||||
for info in comment_infos {
|
for info in comment_infos {
|
||||||
|
|
||||||
if info.begin == info.end {
|
if info.begin == info.end || info.length == 0 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,8 +63,10 @@ push_comment :: proc(p: ^Printer, comment: tokenizer.Token) -> int {
|
|||||||
format_token.spaces_before = 0;
|
format_token.spaces_before = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.current_line.used = true;
|
if !p.current_line.used {
|
||||||
p.current_line.depth = p.depth;
|
p.current_line.used = true;
|
||||||
|
p.current_line.depth = p.depth;
|
||||||
|
}
|
||||||
|
|
||||||
append(&p.current_line.format_tokens, format_token);
|
append(&p.current_line.format_tokens, format_token);
|
||||||
p.last_token = &p.current_line.format_tokens[len(p.current_line.format_tokens)-1];
|
p.last_token = &p.current_line.format_tokens[len(p.current_line.format_tokens)-1];
|
||||||
@@ -135,8 +137,10 @@ push_comment :: proc(p: ^Printer, comment: tokenizer.Token) -> int {
|
|||||||
unindent(p);
|
unindent(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.current_line.used = true;
|
if !p.current_line.used {
|
||||||
p.current_line.depth = p.depth;
|
p.current_line.used = true;
|
||||||
|
p.current_line.depth = p.depth;
|
||||||
|
}
|
||||||
|
|
||||||
append(&p.current_line.format_tokens, format_token);
|
append(&p.current_line.format_tokens, format_token);
|
||||||
p.last_token = &p.current_line.format_tokens[len(p.current_line.format_tokens)-1];
|
p.last_token = &p.current_line.format_tokens[len(p.current_line.format_tokens)-1];
|
||||||
@@ -416,7 +420,7 @@ visit_decl :: proc(p: ^Printer, decl: ^ast.Decl, called_in_stmt := false) {
|
|||||||
|
|
||||||
if v.type != nil {
|
if v.type != nil {
|
||||||
if !v.is_mutable && v.type != nil {
|
if !v.is_mutable && v.type != nil {
|
||||||
push_generic_token(p, .Colon, 1);
|
push_generic_token(p, .Colon, 0);
|
||||||
} else {
|
} else {
|
||||||
push_generic_token(p, .Colon, 0);
|
push_generic_token(p, .Colon, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user