-
Notifications
You must be signed in to change notification settings - Fork 914
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
New sprintf implementation #7612
base: master
Are you sure you want to change the base?
Commits on Oct 14, 2021
-
Beginnings of a new sprintf parser/interpreter.
The goal of this new design is to make it much simpler to modify and update when we find a bug or have to add a new identifier. A secondary longer goal is to decouple processing of the format string from the generation of the final string when executing sprintf. The value of this decoupling is we can push the format parsing phase into the sprintf callsite so we only have to process the format once. In fact once we get to that point we can potentially just bytecode generate the string building piece. The current point of this work is we can completely parse the format string into a sequence of tokens. It is done sans bugs or decisions to add/change any fields based on work on the interpreter. At this point to use it you need to set the env var SPRINTF=anything to enable new runtime and it will only work with %i, %d, and %u. Future work will be to keep adding new directives but not be trying very hard to make one method process to many directives. In the case of the three (i,d,u) 'i' is an alias of 'd' and 'u' processes unsigned values a little differently when setting up the value. Any more complexity and u would have been its own method.
Configuration menu - View commit details
-
Copy full SHA for 78944ef - Browse repository at this point
Copy the full SHA 78944efView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0ddff4d - Browse repository at this point
Copy the full SHA 0ddff4dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 762f06d - Browse repository at this point
Copy the full SHA 762f06dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 289b71a - Browse repository at this point
Copy the full SHA 289b71aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 978dcc5 - Browse repository at this point
Copy the full SHA 978dcc5View commit details -
Sketchy fix for %%d -> %d for printf
May need to unit test byteListUpto but for now this passes more tests.
Configuration menu - View commit details
-
Copy full SHA for ef223bb - Browse repository at this point
Copy the full SHA ef223bbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 25abce1 - Browse repository at this point
Copy the full SHA 25abce1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 09dccb9 - Browse repository at this point
Copy the full SHA 09dccb9View commit details -
Configuration menu - View commit details
-
Copy full SHA for e09cce9 - Browse repository at this point
Copy the full SHA e09cce9View commit details -
Dual using token.width is confusing. Just make another field.
indexed args in sprintf were still also using that index as its width.
Configuration menu - View commit details
-
Copy full SHA for e4b287d - Browse repository at this point
Copy the full SHA e4b287dView commit details -
Allow <name> to accept additional formatting.
getArg will now get named parameters.
Configuration menu - View commit details
-
Copy full SHA for 03b3eab - Browse repository at this point
Copy the full SHA 03b3eabView commit details
Commits on Oct 15, 2021
-
Configuration menu - View commit details
-
Copy full SHA for b9af53e - Browse repository at this point
Copy the full SHA b9af53eView commit details -
Change some visibility on token fields.
Implement argument errors for mixed format specifiers.
Configuration menu - View commit details
-
Copy full SHA for 98fa357 - Browse repository at this point
Copy the full SHA 98fa357View commit details
Commits on Oct 17, 2021
-
Fix assumed ordering of indexed arguments.
The parser assumed width and arg index would occur in the same order: %*1$2$d but it can also be: %2$*1$d I also changed some naming.
Configuration menu - View commit details
-
Copy full SHA for 785d657 - Browse repository at this point
Copy the full SHA 785d657View commit details -
Made mistake in last commit in naming.
I fixed another incompatibility and realized hasWidth is the right name. This commit also fixed asking for next arg if hasWidth for an unnumbered format field.
Configuration menu - View commit details
-
Copy full SHA for 0b44a2a - Browse repository at this point
Copy the full SHA 0b44a2aView commit details -
Fix first long-standing bug in spec/ruby for sprintf.
%#o with a negative values does not prefix with a '0'. Strange but true.
Configuration menu - View commit details
-
Copy full SHA for 03f2102 - Browse repository at this point
Copy the full SHA 03f2102View commit details -
Fix another long standing problem. mixed error now thrown.
"%*10d" is mixing numbered '*' with 10d unnumbered.
Configuration menu - View commit details
-
Copy full SHA for 25125b2 - Browse repository at this point
Copy the full SHA 25125b2View commit details
Commits on Oct 19, 2021
-
Fix most remaining issues in test:mri except a single oddity involing…
… succ. Lots of random fixes to the sprintf parser. A grab bag of smaller fixes.
Configuration menu - View commit details
-
Copy full SHA for 2e7042e - Browse repository at this point
Copy the full SHA 2e7042eView commit details -
Telling between explictly supplied precision and an argument provided one is still messy but it should be working now. I will try and circle back to simplify FormatToken since the other two (index, width) are not as complex. Also removed dead parameter in processDigits.
Configuration menu - View commit details
-
Copy full SHA for c4a9b42 - Browse repository at this point
Copy the full SHA c4a9b42View commit details -
%5.0d was zero padding and asking for an extra argument before this change.
Configuration menu - View commit details
-
Copy full SHA for e45beef - Browse repository at this point
Copy the full SHA e45beefView commit details
Commits on Oct 22, 2021
-
Reverse SPRINTF env to run new sprintf it unset.
We now pass more specs and tests with new code and we also want to see mistakes made with the new code during CI runs.
Configuration menu - View commit details
-
Copy full SHA for 210c522 - Browse repository at this point
Copy the full SHA 210c522View commit details
Commits on Oct 24, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 34854aa - Browse repository at this point
Copy the full SHA 34854aaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d1a38a - Browse repository at this point
Copy the full SHA 9d1a38aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 39c73c7 - Browse repository at this point
Copy the full SHA 39c73c7View commit details -
Configuration menu - View commit details
-
Copy full SHA for fb6e223 - Browse repository at this point
Copy the full SHA fb6e223View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5dc668c - Browse repository at this point
Copy the full SHA 5dc668cView commit details
Commits on Oct 25, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 4b1a9d9 - Browse repository at this point
Copy the full SHA 4b1a9d9View commit details
Commits on Oct 26, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 396cd98 - Browse repository at this point
Copy the full SHA 396cd98View commit details -
Configuration menu - View commit details
-
Copy full SHA for 95f5fd2 - Browse repository at this point
Copy the full SHA 95f5fd2View commit details
Commits on Nov 5, 2021
-
Configuration menu - View commit details
-
Copy full SHA for a67836f - Browse repository at this point
Copy the full SHA a67836fView commit details
Commits on Nov 18, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 70deb32 - Browse repository at this point
Copy the full SHA 70deb32View commit details -
new_sprintf WIP: support for %c failing tests
Fails two specs and one mri test Modified: core/src/main/java/org/jruby/util/SprintfParser.java
Configuration menu - View commit details
-
Copy full SHA for 37f2374 - Browse repository at this point
Copy the full SHA 37f2374View commit details -
Configuration menu - View commit details
-
Copy full SHA for 44a34c3 - Browse repository at this point
Copy the full SHA 44a34c3View commit details -
new_sprintf WIP: added support for %s
According to local tests just one test fail
Configuration menu - View commit details
-
Copy full SHA for 15e976f - Browse repository at this point
Copy the full SHA 15e976fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6afdae9 - Browse repository at this point
Copy the full SHA 6afdae9View commit details
Commits on Nov 23, 2021
-
Explicit width can mark rightpad at parse time.
This unfortunately does not mean it still does not need to check it in the case of '*' but it makes sense to make the token as known as possible.
Configuration menu - View commit details
-
Copy full SHA for 411d3ad - Browse repository at this point
Copy the full SHA 411d3adView commit details
Commits on Dec 2, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 73116ae - Browse repository at this point
Copy the full SHA 73116aeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0298a8e - Browse repository at this point
Copy the full SHA 0298a8eView commit details
Commits on Dec 3, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 754a32f - Browse repository at this point
Copy the full SHA 754a32fView commit details
Commits on Dec 17, 2021
-
Configuration menu - View commit details
-
Copy full SHA for dd6e128 - Browse repository at this point
Copy the full SHA dd6e128View commit details -
Configuration menu - View commit details
-
Copy full SHA for 049d4ee - Browse repository at this point
Copy the full SHA 049d4eeView commit details