-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
solve the problem of failed parsing of STL containers #433
Conversation
As the next entry in that loop is the parsing of primitives and that cannot include text I suggest to not check for I do wonder what the output of a container containing containers look like. Can you please test? Can you try to replace "" by the part before the In any case please add the Changelog entry. |
|
it seems check for |
You're right. if (value.match(/^[^=]* = /) {
const eqPos = valuie.indexOf("="):
value = value.substring(eqPos + 2)):
return parseValue():
} should fix that and drop the trim. |
Please rebase, so that we have only one (squashed) or two commits (which I'd use the "merge squashed" operation for) and a clearer diff. |
What is the mi2 output which fails to parse? Does it work (at least as good as the current version) when replacing the |
it's strange sucess
fail
test code:, break point 139
|
pls dont merge, there is still a bug. i will fix next week. |
work fine:
|
Do you have any idea what's wrong with |
Sounds like |
Yes, I have tried it. The "value.match(/^[^ =]* = /)" matches "std::* =", but it also matches other strings, such as _M_elems = {1, 2, 3} and [0] = 6, [1] = 7, [2] = 8, [3] = 9, [4] = 10, etc. |
Can you please add a Changelog entry and squash the commits to one? |
Of course, I will handle it right away. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your bugfix!
The unwanted revert needs a fix, the "tmp" part should be adjusted for keeping the style.
It is sad, that your useful examples will only stay in the issue - it would be nice if we could add that to the testsuite - but I haven't had a deeper look into that...
Maybe add the samples at least in the detail part of the commit message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the testcase adjustment! All code looks fine to me but I'm confused about the lamda input and return. Can you please explain that to me?
src/backend/gdb_expansion.ts
Outdated
value = value.trim(); | ||
if (value[0] == ','){ | ||
let tmp = value; | ||
tmp = tmp.substring(1).trim(); | ||
if(tmp.startsWith("<No data fields>")){ | ||
value = tmp.replace(/^<No data fields>/, ""); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that just the following?
value = value.replace(/^, <No data fields>/, "");
The one question open - I haven't recognized that before: value
is an outer variable, maybe it should be passed in via the lambda and also be returned?
But I'm also not sure: How is value:val
in the return related to changing value
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value = value.replace(/^, /, "");
that's cool. i tested, work fine.
The value of val has already been correctly obtained before the processing of value = value.replace(/^, /, "");. The processing with value = value.replace(/^, /, ""); is necessary because not removing ", " will affect the subsequent parsing.
Nice work! On to the next issue :-) |
solve the problem of failed parsing of STL containers