fix syntax error in parse_object function clause

This commit is contained in:
Fly Dev 2025-06-23 14:31:53 +00:00
parent f7203ba27e
commit 48fbd02fcb

View file

@ -1,5 +1,3 @@
# @dialyzer {:nowarn_function, parse_data: 3}
# @dialyzer {:nowarn_function, parse_object: 1}
defmodule Parser do defmodule Parser do
@moduledoc """ @moduledoc """
Main parsing library Main parsing library
@ -710,9 +708,7 @@ defmodule Parser do
end end
# Object Report parsing # Object Report parsing
def parse_object( def parse_object(<<";", object_name::binary-size(9), live_killed::binary-size(1), rest::binary>>) do
<<";", object_name::binary-size(9), live_killed::binary-size(1),
) do
position_data = position_data =
case rest do case rest do
# Uncompressed position format # Uncompressed position format
@ -765,7 +761,7 @@ defmodule Parser do
%{ %{
object_name: String.trim(object_name), object_name: String.trim(object_name),
live_killed: live_killed, live_killed: live_killed,
timestamp: timestamp, timestamp: nil,
data_type: :object data_type: :object
}, },
position_data position_data
@ -784,7 +780,7 @@ defmodule Parser do
@spec parse_item(binary()) :: map() @spec parse_item(binary()) :: map()
def parse_item(<<item_indicator, item_name_and_data::binary>>) when item_indicator in [?%, ?)] do def parse_item(<<item_indicator, item_name_and_data::binary>>) when item_indicator in [?%, ?)] do
# Items can have up to 9 character names, followed by ! for position or _ for killed # Items can have up to 9 character names, followed by ! for position or _ for killed
case Regex.run(~r/^(.{1,9})([\!\_])(.*)$/, item_name_and_data) do case Regex.run(~r/^(.{1,9})([!\_])(.*)$/, item_name_and_data) do
[_, item_name, status_char, position_data] -> [_, item_name, status_char, position_data] ->
parsed_position = parse_item_position(position_data) parsed_position = parse_item_position(position_data)