Remove dr
and integrate into d
#11
No reviewers
Labels
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Lephenixnoir/fxos#11
Loading…
Reference in New Issue
No description provided.
Delete Branch "Dr-Carlos/fxos:remove-dr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello!
Looking back over issue #3, I remember a plan that
dr
would be removed andd
would now be able to accept an address or a range.This PR plans to implement this plan.
Currently I have removed dr and added token options to the parser's atom() and expr() functions. These are optional and mean that atom() uses that token instead of expecting one, allowing
d
to try and get a range from the parser, then fall back on the first token (saved using lookahead) if it fails.Whilst this works, it unfortunately doesn't work with arithemtic. For example,
d $
,d $:0x100
,d %0 ..%2
, andd %100
all work. However,d ($+100)
doesn't, raising the errorexpected '$', '(', '-', symbol, number, or syscall number; instead found end of file
.Hence, this PR is WIP as I am unsure how to fix this issue. If you have any suggestions, please let me know.
Thanks. I must admit I am a bit confused by your approach, specifically the
token
argument toatom()
andexpr()
.I have pushed on the
expr-and-ranges
branch what I had in mind, which is just an extra parser function which reads an expression, and then checks whether it's followed by..
or:
to build a range.Let me know if that version covers what you have tested so far. If so, we can surely merge it with the nice logic you have written on
d
to get rid ofdr
.3a003de190
toc66ae1d5c6
WIP: Remove `dr` and integrate into `d`to Remove `dr` and integrate into `d`Thanks for writing the
expr_or_range
function, it's a much better solution than what I was doing. I have changed the implementation to use this function, and it works with everything I have tested.Ignore the weird logs about adding commits, from the 'Commits' tab you can see that it's just the three commits - my original one, yours, and the new one.
If you're fine with this, please merge it.
Thanks, there's just one detail I forgot to mention about the options. I can make the change later if you prefer.
@ -82,2 +74,2 @@
return address;
}
std::optional<uint32_t> address;
std::optional<Range> range;
Can we keep the variant at this stage and just check
holds_alternative
in the_d
function instead? This sort of suggests that we can specify both or neither, which wouldn't make much sense.Yep, makes sense. Implemented in latest commit.
Yeah, that makes sense. Latest commit implements this.
Excellent, thank you very much!