aboutsummaryrefslogtreecommitdiff
path: root/core/unicode
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-09-30 15:34:39 +0100
committergingerBill <bill@gingerbill.org>2023-09-30 15:34:39 +0100
commit14adcb9db89f4a668210a56d909cdca96088aae2 (patch)
tree3f11a5d5ca0dd638387abc60e6cc50a8e1604d0c /core/unicode
parent41a22bd83d9458249a60a9d1415f4862f1593b76 (diff)
Use `or_break` and `or_continue` where appropriate in the core library
Diffstat (limited to 'core/unicode')
-rw-r--r--core/unicode/tools/generate_entity_table.odin70
1 files changed, 33 insertions, 37 deletions
diff --git a/core/unicode/tools/generate_entity_table.odin b/core/unicode/tools/generate_entity_table.odin
index fb4e4c2a4..e5a4d5513 100644
--- a/core/unicode/tools/generate_entity_table.odin
+++ b/core/unicode/tools/generate_entity_table.odin
@@ -86,44 +86,40 @@ generate_encoding_entity_table :: proc() {
nth := 0
for {
- character_entity, entity_ok := xml.find_child_by_ident(char, "entity", nth)
- if !entity_ok { break }
-
- nth += 1
- if name, name_ok := xml.find_attribute_val_by_key(character_entity, "id"); name_ok {
-
- if len(name) == 0 {
- /*
- Invalid name. Skip.
- */
- continue
- }
-
- if name == "\"\"" {
- printf("%#v\n", char)
- printf("%#v\n", character_entity)
- }
-
- if len(name) > max_name_length { longest_name = name }
- if len(name) < min_name_length { shortest_name = name }
-
- min_name_length = min(min_name_length, len(name))
- max_name_length = max(max_name_length, len(name))
-
- e := Entity{
- name = name,
- codepoint = rune(codepoint),
- description = description,
- }
-
- if _, seen := entity_map[name]; seen {
- continue
- }
-
- entity_map[name] = e
- append(&names, name)
- count += 1
+ character_entity := xml.find_child_by_ident(char, "entity", nth) or_break
+ nth += 1
+ name := xml.find_attribute_val_by_key(character_entity, "id") or_continue
+ if len(name) == 0 {
+ /*
+ Invalid name. Skip.
+ */
+ continue
}
+
+ if name == "\"\"" {
+ printf("%#v\n", char)
+ printf("%#v\n", character_entity)
+ }
+
+ if len(name) > max_name_length { longest_name = name }
+ if len(name) < min_name_length { shortest_name = name }
+
+ min_name_length = min(min_name_length, len(name))
+ max_name_length = max(max_name_length, len(name))
+
+ e := Entity{
+ name = name,
+ codepoint = rune(codepoint),
+ description = description,
+ }
+
+ if name in entity_map {
+ continue
+ }
+
+ entity_map[name] = e
+ append(&names, name)
+ count += 1
}
}
}