Skip to content

Commit

Permalink
Merge pull request #27 from Decompollaborate/develop
Browse files Browse the repository at this point in the history
2.3.7
  • Loading branch information
AngheloAlf authored Feb 28, 2024
2 parents 1d3b5da + cec5236 commit ded5b55
Show file tree
Hide file tree
Showing 21 changed files with 102,081 additions and 25,319 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.3.7] - 2024-02-27

### Fixed

- Fix not recognizing file entries which are splited in two lines because its
section name was too long to fit.

## [2.3.6] - 2024-02-23

### Added
Expand Down Expand Up @@ -324,6 +331,7 @@ Full changes: <https://github.com/Decompollaborate/mapfile_parser/compare/702a73
- Initial release

[unreleased]: https://github.com/Decompollaborate/mapfile_parser/compare/master...develop
[2.3.7]: https://github.com/Decompollaborate/mapfile_parser/compare/2.3.6...2.3.7
[2.3.6]: https://github.com/Decompollaborate/mapfile_parser/compare/2.3.5...2.3.6
[2.3.5]: https://github.com/Decompollaborate/mapfile_parser/compare/2.3.4...2.3.5
[2.3.4]: https://github.com/Decompollaborate/mapfile_parser/compare/2.3.2...2.3.4
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[package]
name = "mapfile_parser"
version = "2.3.6"
version = "2.3.7"
edition = "2021"
authors = ["Anghelo Carvajal <[email protected]>"]
description = "Map file parser library focusing decompilation projects"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ If you use a `requirements.txt` file in your repository, then you can add
this library with the following line:

```txt
mapfile_parser>=2.3.6,<3.0.0
mapfile_parser>=2.3.7,<3.0.0
```

#### Development version
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[project]
name = "mapfile_parser"
version = "2.3.6"
version = "2.3.7"
description = "Map file parser library focusing decompilation projects"
readme = "README.md"
requires-python = ">=3.7"
Expand Down
2 changes: 1 addition & 1 deletion src/mapfile_parser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from __future__ import annotations

__version_info__ = (2, 3, 6)
__version_info__ = (2, 3, 7)
__version__ = ".".join(map(str, __version_info__))
__author__ = "Decompollaborate"

Expand Down
39 changes: 30 additions & 9 deletions src/rs/mapfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ impl MapFile {
*/
pub fn parse_map_contents_gnu(&mut self, map_contents: String) {
// TODO: maybe move somewhere else?
let regex_file_data_entry = Regex::new(r"^\s+(?P<section>[^*][^\s]+)\s+(?P<vram>0x[^\s]+)\s+(?P<size>0x[^\s]+)\s+(?P<name>[^\s]+)$").unwrap();
let regex_section_alone_entry = Regex::new(r"^\s+(?P<section>[^*][^\s]+)\s*$").unwrap();
let regex_file_data_entry = Regex::new(r"^\s+(?P<section>([^*][^\s]+)?)\s+(?P<vram>0x[^\s]+)\s+(?P<size>0x[^\s]+)\s+(?P<name>[^\s]+)$").unwrap();
let regex_function_entry =
Regex::new(r"^\s+(?P<vram>0x[^\s]+)\s+(?P<name>[^\s]+)$").unwrap();
// regex_function_entry = re.compile(r"^\s+(?P<vram>0x[^\s]+)\s+(?P<name>[^\s]+)((\s*=\s*(?P<expression>.+))?)$")
Expand Down Expand Up @@ -141,15 +142,35 @@ impl MapFile {
let section_type = &file_entry_match["section"];

if size > 0 {
in_file = true;
let current_segment = temp_segment_list.last_mut().unwrap();
// TODO: de-duplicate the following code:

if !section_type.is_empty() {
in_file = true;
let current_segment = temp_segment_list.last_mut().unwrap();

current_segment.files_list.push(file::File::new_default(
filepath,
vram,
size,
section_type,
));
} else if let Some(section_alone_match) =
regex_section_alone_entry.captures(prev_line)
{
// Some sections may be too large, making the entry be splitted between two lines, making the section name be in one line and the rest of the info in the next one

current_segment.files_list.push(file::File::new_default(
filepath,
vram,
size,
section_type,
));
let section_type = &section_alone_match["section"];

in_file = true;
let current_segment = temp_segment_list.last_mut().unwrap();

current_segment.files_list.push(file::File::new_default(
filepath,
vram,
size,
section_type,
));
}
}
} else if let Some(segment_entry_match) = regex_segment_entry.captures(line) {
let mut name = &segment_entry_match["name"];
Expand Down
Loading

0 comments on commit ded5b55

Please sign in to comment.