Skip to content

Commit

Permalink
Showing 298 changed files with 11,542 additions and 9,411 deletions.
4 changes: 2 additions & 2 deletions core/pom.rb
Original file line number Diff line number Diff line change
@@ -44,8 +44,8 @@
jar 'com.github.jnr:jnr-enxio:0.9'
jar 'com.github.jnr:jnr-x86asm:1.0.2'
jar 'com.github.jnr:jnr-unixsocket:0.8'
jar 'com.github.jnr:jnr-posix:3.0.13-SNAPSHOT'
jar 'com.github.jnr:jnr-constants:0.8.7'
jar 'com.github.jnr:jnr-posix:3.0.14'
jar 'com.github.jnr:jnr-constants:0.8.8'
jar 'com.github.jnr:jnr-ffi:2.0.3'
jar 'com.github.jnr:jffi:${jffi.version}'
jar 'com.github.jnr:jffi:${jffi.version}:native'
4 changes: 2 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
@@ -105,12 +105,12 @@
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-posix</artifactId>
<version>3.0.13-SNAPSHOT</version>
<version>3.0.14</version>
</dependency>
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-constants</artifactId>
<version>0.8.7</version>
<version>0.8.8</version>
</dependency>
<dependency>
<groupId>com.github.jnr</groupId>
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@
import org.jruby.ast.FCallNode;
import org.jruby.ast.GlobalAsgnNode;
import org.jruby.ast.GlobalVarNode;
import org.jruby.ast.StrNode;
import org.jruby.ast.VCallNode;
import org.jruby.ast.WhileNode;
import org.jruby.compiler.Constantizable;
@@ -702,6 +703,7 @@ private RootNode addGetsLoop(RootNode oldRoot, boolean printing, boolean process
whileBody.add(oldRoot.getBodyNode());
}

newBody.prepend(new GlobalAsgnNode(pos, "$/", new StrNode(pos, new ByteList(getInstanceConfig().getRecordSeparator().getBytes()))));
GlobalVarNode dollarUnderscore = new GlobalVarNode(pos, "$_");

newBody.add(new WhileNode(pos, new VCallNode(pos, "gets"), whileBody));
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -965,18 +965,18 @@ public RubyString newFrozen() {
klass = getMetaClass();
str = strDup(klass.getClassRuntime());
str.setCodeRange(getCodeRange());
str.modify();
str.setFrozen(true);
return str;
}

/** rb_str_resize
*/
public final void resize(int length) {
modify();
if (value.getRealSize() > length) {
modify();
value.setRealSize(length);
} else if (value.length() < length) {
modify();
value.length(length);
}
}
3 changes: 3 additions & 0 deletions core/src/main/java/org/jruby/ast/Match3Node.java
Original file line number Diff line number Diff line change
@@ -36,6 +36,9 @@
import org.jruby.ast.visitor.NodeVisitor;
import org.jruby.lexer.yacc.ISourcePosition;

/**
* Used when a Regexp literal is the RHS of a match call. E.g., "abc" =~ /.+/
*/
public class Match3Node extends Node {
private final Node receiverNode;
private final Node valueNode;
393 changes: 213 additions & 180 deletions core/src/main/java/org/jruby/ext/ripper/RipperLexer.java

Large diffs are not rendered by default.

1,569 changes: 815 additions & 754 deletions core/src/main/java/org/jruby/ext/ripper/RipperParser.java

Large diffs are not rendered by default.

43 changes: 32 additions & 11 deletions core/src/main/java/org/jruby/ext/ripper/RipperParser.y
Original file line number Diff line number Diff line change
@@ -887,8 +887,12 @@ arg : lhs '=' arg {
| kDEFINED opt_nl arg {
$$ = p.dispatch("on_defined", $3);
}
| arg '?' arg opt_nl ':' arg {
$$ = p.dispatch("on_ifop", $1, $3, $6);
| arg '?' {
p.getConditionState().begin();
} arg opt_nl ':' {
p.getConditionState().end();
} arg {
$$ = p.dispatch("on_ifop", $1, $4, $8);
}
| primary {
$$ = $1;
@@ -1024,19 +1028,27 @@ primary : literal
| tFID {
$$ = p.dispatch("on_method_add_arg", p.dispatch("on_fcall", $1), p.dispatch("on_args_new"));
}
| kBEGIN bodystmt kEND {
$$ = p.dispatch("on_begin", $2);
| kBEGIN {
$$ = p.getCmdArgumentState().getStack();
p.getCmdArgumentState().reset();
} bodystmt kEND {
p.getCmdArgumentState().reset($<Long>2.longValue());
$$ = p.dispatch("on_begin", $3);
}
| tLPAREN_ARG {
p.setState(LexState.EXPR_ENDARG);
} rparen {
$$ = p.dispatch("on_paren", null);
}
| tLPAREN_ARG expr {
| tLPAREN_ARG {
$$ = p.getCmdArgumentState().getStack();
p.getCmdArgumentState().reset();
} expr {
p.setState(LexState.EXPR_ENDARG);
} rparen {
p.getCmdArgumentState().reset($<Long>2.longValue());
p.warning("(...) interpreted as grouped expression");
$$ = p.dispatch("on_paren", $2);
$$ = p.dispatch("on_paren", $3);
}
| tLPAREN compstmt tRPAREN {
$$ = p.dispatch("on_paren", $2);
@@ -1611,15 +1623,24 @@ string_content : tSTRING_CONTENT
}
| tSTRING_DBEG {
$$ = p.getStrTerm();
p.getConditionState().stop();
p.getCmdArgumentState().stop();
p.setStrTerm(null);
p.getConditionState().stop();
} {
$$ = p.getCmdArgumentState().getStack();
p.getCmdArgumentState().reset();
} {
$$ = p.getState();
p.setState(LexState.EXPR_BEG);
} compstmt tRCURLY {
} {
$$ = p.getBraceNest();
p.setBraceNest(0);
} compstmt tSTRING_DEND {
p.getConditionState().restart();
p.getCmdArgumentState().restart();
p.setStrTerm($<StrTerm>2);
$$ = p.dispatch("on_string_embexpr", $3);
p.getCmdArgumentState().reset($<Long>3.longValue());
p.setState($<LexState>4);
p.setBraceNest($<Integer>5);
$$ = p.dispatch("on_string_embexpr", $6);
}

string_dvar : tGVAR {
23 changes: 20 additions & 3 deletions core/src/main/java/org/jruby/ext/ripper/RipperParserBase.java
Original file line number Diff line number Diff line change
@@ -210,11 +210,16 @@ public IRubyObject method_optarg(IRubyObject method, IRubyObject arg) {
}

public IRubyObject keyword_arg(IRubyObject key, IRubyObject value) {
RubyHash hash = RubyHash.newHash(context.runtime);
RubyArray array = RubyArray.newArray(context.runtime, 2);

hash.fastASet(key, value);
array.append(key);
if (value != null) {
array.append(value);
} else {
array.append(context.nil);
}

return hash;
return array;
}

public IRubyObject new_args(IRubyObject f, IRubyObject o, IRubyObject r, IRubyObject p, ArgsTailHolder tail) {
@@ -351,6 +356,18 @@ public int getInSingle() {
return inSingleton;
}

public int getBraceNest() {
return lexer.getBraceNest();
}

public LexState getState() {
return lexer.getState();
}

public void setBraceNest(int braceNest) {
lexer.setBraceNest(braceNest);
}

public void setState(LexState lexState) {
lexer.setState(lexState);
}
Loading

0 comments on commit 497148b

Please sign in to comment.