Page MenuHomePhabricator

[ms] [llvm-ml] Lex MASM strings, including escaping

Authored by epastor on Oct 19 2020, 1:51 PM.



Allow single-quoted strings and double-quoted character values, as well as doubled-quote escaping.

Diff Detail

Event Timeline

epastor created this revision.Oct 19 2020, 1:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 19 2020, 1:51 PM
epastor requested review of this revision.Oct 19 2020, 1:51 PM

This is missing tests for almost all of the functionality added in this patch ('asdf''''jkl' -> asdf''jkl but "asdf''''jkl" -> asdf''''jkl, similar for with ' and " swapped, and the single-char case).


put a return AsmToken(AsmToken::String, StringRef(TokStart, CurPtr - TokStart)); here, and leave the rest of the function unmodified

thakis requested changes to this revision.Nov 2 2020, 4:13 PM
This revision now requires changes to proceed.Nov 2 2020, 4:13 PM
epastor updated this revision to Diff 302660.Nov 3 2020, 12:23 PM

Reduce diff, and add specific tests of new functionality

epastor updated this revision to Diff 302661.Nov 3 2020, 12:26 PM

Add test for handling of single characters in expressions (even in double-quotes)

epastor updated this revision to Diff 302665.Nov 3 2020, 12:36 PM

Add tests for quote characters in expressions, with and without escaping

epastor marked an inline comment as done.Nov 3 2020, 2:27 PM

Tests added; thank you!

thakis accepted this revision.Nov 4 2020, 11:30 AM

lg if the lack of \0-termination is intentional


just to verify, these strings are not 0-terminated? (why is the single-char case a special case then?)


Oh I guess for this.

This revision is now accepted and ready to land.Nov 4 2020, 11:30 AM
epastor marked 2 inline comments as done.Nov 4 2020, 12:25 PM
epastor added inline comments.

Correct - null termination has to be manually added by passing a zero initializer after the string. (e.g.,

This revision was landed with ongoing or failed builds.Nov 4 2020, 12:29 PM
This revision was automatically updated to reflect the committed changes.
epastor marked an inline comment as done.