-
Notifications
You must be signed in to change notification settings - Fork 57
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
interpolated strings, v2 #510
base: master
Are you sure you want to change the base?
interpolated strings, v2 #510
Conversation
better implementation, doing all the tokenizing at the start, an interpolated string being multiple tokens
✅ PR OK, no changes in deprecations or warnings Total deprecations: 0 Total warnings: 0 Build statistics: ------ libdparse statistics ------
statistics (-before, +after)
-library size=3163068 libdparse.a
+library size=3197196 libdparse.a
rough build time=16s
------ DCD statistics ------
statistics (-before, +after)
client size=1048544 bin/dcd-client
-server size=3089912 bin/dcd-server
+server size=3115384 bin/dcd-server
rough build time=74s
-DCD run_tests.sh Elapsed (wall clock) time (h:mm:ss or m:ss): 0:08.57
-DCD run_tests.sh Maximum resident set size (kbytes): 45216
+DCD run_tests.sh Elapsed (wall clock) time (h:mm:ss or m:ss): 0:08.43
+DCD run_tests.sh Maximum resident set size (kbytes): 41324
short requests: (230x)
- min request time = 0.009ms
- 10th percentile = 0.123ms
- median time = 0.431ms
- 90th percentile = 0.747ms
- max request time = 2.228ms
+ min request time = 0.013ms
+ 10th percentile = 0.116ms
+ median time = 0.434ms
+ 90th percentile = 0.753ms
+ max request time = 1.557ms
long requests over 10ms: (51x)
- min request time = 17.360ms
- 10th percentile = 17.650ms
- median time = 18.672ms
- 90th percentile = 21.157ms
- max request time = 30.142ms
+ min request time = 16.499ms
+ 10th percentile = 17.705ms
+ median time = 18.483ms
+ 90th percentile = 20.505ms
+ max request time = 29.069ms
top 5 GC sources in server:
bytes allocated, allocations, type, function, file:line
78109696 843 void[] std.array.Appender!(TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields,TriviaToken; mixin TokenTriviaFields;")[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.105.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3634
15257216 476788 void[] core.lifetime._d_newitemT!(Data)._d_newitemT /opt/hostedtoolcache/dc/dmd-2.105.2/x64/dmd2/linux/bin64/../../src/druntime/import/core/lifetime.d:2833
14316800 164422 void[] std.array.Appender!(DSymbol*[]).Appender.ensureAddable.__lambda9 /opt/hostedtoolcache/dc/dmd-2.105.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3634
9773344 305417 Data std.array.Appender!string.Appender.this /opt/hostedtoolcache/dc/dmd-2.105.2/x64/dmd2/linux/bin64/../../src/phobos/std/array.d:3509
7372208 281 ubyte[] msgpack.unpacker.Unpacker.InternalBuffer!().initializeBuffer ../../../../.dub/packages/msgpack-d/1.0.4/msgpack-d/src/msgpack/common.d:628 Full build output
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #510 +/- ##
==========================================
+ Coverage 84.25% 84.34% +0.08%
==========================================
Files 11 11
Lines 8561 8776 +215
==========================================
+ Hits 7213 7402 +189
- Misses 1348 1374 +26
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
496ed47
to
bdd87a6
Compare
I'm all for merging this. I don't really have a good feel for what is the proper way to do these things, but we definitely need something. As noted from the linked bug reports, people are finding the lack of istring support troublesome, and it will only get worse. I think it is better to have a buggy or substandard implementation than no attempt. Needs a rebase though... |
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.
Caveat: I'm not a compiler dev, so this is an approval of the improvement, not necessarily the code. Nothing stands out as bad to me.
Same idea as in the compiler. The lexer has a mini parser that consumes tokens and spits out others. It at least lines up. |
Not sure this is still being worked on, but with this branch, iq{...} with line breaks in them are syntax errors, even though dmd accepts them just fine (as you would expect); q{...} with linebreaks parses fine. enum foo = iq{
}; reports foo.d(1:15)[error]: Expected `;` instead of EOF |
i gotta get this into adrdox and the code looks ok to me, i gotta do adaptation to fit in my code but i think i can use most of it so ill let you know how it goes (though i avoid using new features in the libraries so it isn't going to be a very comprehensive test, still it is some) |
can confirm the Looks like the first { is not seen by the lexIstringPlain function. In I suggest deleting the Then in lexIstringPlain:
but this fails:
so i don't think this approach is correct at all really, it sh ould be running a child lexer inside the q{} thing. |
Yeah, I think the best approach is to copy/paste from tho tbh for now adrdox is just gonna leave it as a |
Bump. What would it take to get this over the finish line? We have a backup of PR's waiting on this. |
missing: tests & fixes for the iq{} strings, like mentioned in the comments by others |
Any chance we can get this resolved/merged during/prior to BeerConf this month? |
better implementation, doing all the tokenizing at the start, an interpolated string being multiple tokens
requires no further changes in DCD to support with auto-completion, probably also going to just work with D-Scanner and serve-d
supersedes #508
implementation for DIP1036e