Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 64068c4941ba^
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f9d23da6c160
Choose a head ref
  • 6 commits
  • 12 files changed
  • 1 contributor

Commits on Dec 12, 2015

  1. Copy the full SHA
    64068c4 View commit details

Commits on Dec 19, 2015

  1. Copy the full SHA
    04d76b8 View commit details
  2. Copy the full SHA
    ba01412 View commit details
  3. Copy the full SHA
    6e27fc6 View commit details
  4. Copy the full SHA
    de5ca47 View commit details
  5. Copy the full SHA
    f9d23da View commit details
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
*.versionsBackup
*.zip
*~
*.tokens

.DS_Store
.debug.properties
1 change: 1 addition & 0 deletions spec/truffle/tags/core/string/modulo_tags.txt
Original file line number Diff line number Diff line change
@@ -80,3 +80,4 @@ fails:String#% behaves as if calling Kernel#Float for %g arguments, when the pas
fails:String#% behaves as if calling Kernel#Float for %g arguments, when the passed argument is hexadecimal string
fails:String#% behaves as if calling Kernel#Float for %G arguments, when the passed argument does not respond to #to_ary
fails:String#% behaves as if calling Kernel#Float for %G arguments, when the passed argument is hexadecimal string
fails:String#% when format string contains %<> formats should raise ArgumentError if no hash given
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
lexer grammar PrintfLexer;

FORMAT : '%' -> mode(FORMAT_MODE);
LITERAL : (~'%')* ;

mode FORMAT_MODE;

ANGLE_KEY : '<' .*? '>' ;
ZERO : '0' ;
NUMBER : [1-9] [0-9]* ;
SPACE : ' ' ;
PLUS : '+' ;
MINUS : '-' ;
STAR : '*' ;
DOLLAR : '$' ;
DOT : '.' ;
CURLEY_KEY : '{' .*? '}' -> mode(DEFAULT_MODE) ;
TYPE : [bBdiouxXeEfgGaAcps] -> mode(DEFAULT_MODE) ;
ESCAPED : '%' -> mode(DEFAULT_MODE) ;
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
parser grammar PrintfParser;

options { tokenVocab=PrintfLexer; }

sequence : (FORMAT directive | literal)* ;

directive : CURLEY_KEY # string
| ESCAPED # escaped
| ANGLE_KEY?
flag*
width=NUMBER?
(DOT precision=NUMBER)?
TYPE # format ;

flag : SPACE
| ZERO
| PLUS
| MINUS
| STAR
| NUMBER DOLLAR ;

literal : LITERAL ;
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
import com.oracle.truffle.api.dsl.NodeChildren;
import com.oracle.truffle.api.dsl.Specialization;
import org.jruby.truffle.format.nodes.PackNode;
import org.jruby.truffle.format.parser.FormatDirective;
import org.jruby.truffle.format.parser.PrintfTreeBuilder;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.core.StringOperations;
import org.jruby.util.ByteList;
@@ -68,12 +68,12 @@ public ByteList format(double value) {

if (Double.isInfinite(value)) {

if (spacePadding != FormatDirective.DEFAULT) {
if (spacePadding != PrintfTreeBuilder.DEFAULT) {
builder.append(" ");
builder.append(spacePadding + 5);
}

if (zeroPadding != FormatDirective.DEFAULT && zeroPadding != 0) {
if (zeroPadding != PrintfTreeBuilder.DEFAULT && zeroPadding != 0) {
builder.append("0");
builder.append(zeroPadding + 5);
}
@@ -86,20 +86,20 @@ public ByteList format(double value) {

} else {

if (spacePadding != FormatDirective.DEFAULT) {
if (spacePadding != PrintfTreeBuilder.DEFAULT) {
builder.append(" ");
builder.append(spacePadding);

if (zeroPadding != FormatDirective.DEFAULT) {
if (zeroPadding != PrintfTreeBuilder.DEFAULT) {
builder.append(".");
builder.append(zeroPadding);
}
} else if (zeroPadding != FormatDirective.DEFAULT && zeroPadding != 0) {
} else if (zeroPadding != PrintfTreeBuilder.DEFAULT && zeroPadding != 0) {
builder.append("0");
builder.append(zeroPadding);
}

if (precision != FormatDirective.DEFAULT) {
if (precision != PrintfTreeBuilder.DEFAULT) {
builder.append(".");
builder.append(precision);
}
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
import com.oracle.truffle.api.object.DynamicObject;

import org.jruby.truffle.format.nodes.PackNode;
import org.jruby.truffle.format.parser.FormatDirective;
import org.jruby.truffle.format.parser.PrintfTreeBuilder;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.layouts.Layouts;
import org.jruby.util.ByteList;
@@ -94,15 +94,15 @@ protected ByteList doFormat(Object value, int spacePadding, int zeroPadding) {

builder.append("%");

if (spacePadding != FormatDirective.DEFAULT) {
if (spacePadding != PrintfTreeBuilder.DEFAULT) {
builder.append(" ");
builder.append(spacePadding);

if (zeroPadding != FormatDirective.DEFAULT) {
if (zeroPadding != PrintfTreeBuilder.DEFAULT) {
builder.append(".");
builder.append(zeroPadding);
}
} else if (zeroPadding != FormatDirective.DEFAULT) {
} else if (zeroPadding != PrintfTreeBuilder.DEFAULT) {
builder.append("0");
builder.append(zeroPadding);
}

This file was deleted.

Loading