Skip to content

[isoltest] Fixes parsing and printing strings with *basic* escape sequences in it.#7080

Merged
christianparpart merged 1 commit intodevelopfrom
isoltest-string-parse-print-fix
Jul 22, 2019
Merged

[isoltest] Fixes parsing and printing strings with *basic* escape sequences in it.#7080
christianparpart merged 1 commit intodevelopfrom
isoltest-string-parse-print-fix

Conversation

@christianparpart
Copy link
Copy Markdown
Contributor

We explicitly did not implement a fully conformant ANSI escape sequence
parser but only what is needed for now.

break;
case ABIType::String:
os << BytesUtils().formatString(_bytes);
os << BytesUtils().formatString(_bytes, _abiType.size);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we cut it off?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We apply the cut-off such that [61, 62, 63, 00, .., 00] formats nicely to "abc".

@christianparpart christianparpart force-pushed the isoltest-string-parse-print-fix branch from 66c7f12 to a8caead Compare July 15, 2019 10:02
@christianparpart christianparpart force-pushed the isoltest-string-parse-print-fix branch from a8caead to 74a56bc Compare July 15, 2019 10:30
@erak erak self-assigned this Jul 15, 2019
throw Error(Error::Type::ParserError, "\\x used with no following hex digits.");

advance();
if (current() == '"')
Copy link
Copy Markdown
Contributor

@chriseth chriseth Jul 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be an error? (odd number of hex digits)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we actually checked that with what the C/C++ compiler does, which taught us how to treat hex escape sequences at the end of strings. I map the syntax 1:1 and added tests to ensure this. :)

…ences in it.

We explicitly did not implement a fully conformant ANSI escape sequence
parser but only what is needed for now.
@christianparpart christianparpart force-pushed the isoltest-string-parse-print-fix branch from 74a56bc to 58d8243 Compare July 22, 2019 09:32
@christianparpart christianparpart merged commit a640ca6 into develop Jul 22, 2019
@christianparpart christianparpart deleted the isoltest-string-parse-print-fix branch July 22, 2019 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants