Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Most 3.0 stuff currently does not work but this still passes 2.6 specs without crashing. Next phase will be filling out the AST fully so parsing new features will not die during parse itself but during IR building. Things like endless methods no doubt are fully working already as they are just syntactical sugar.
- Loading branch information
Showing
17 changed files
with
9,633 additions
and
7,005 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.jruby.ast; | ||
|
||
import org.jruby.RubySymbol; | ||
import org.jruby.lexer.yacc.LexContext; | ||
import org.jruby.util.ByteList; | ||
|
||
public class DefHolder { | ||
public final RubySymbol name; | ||
public final ByteList current_arg; | ||
public final LexContext ctxt; | ||
|
||
public int line; | ||
public Node singleton = null; | ||
|
||
public DefHolder(RubySymbol name, ByteList currentArg, LexContext ctxt) { | ||
this.name = name; | ||
this.current_arg = currentArg; | ||
this.ctxt = ctxt; | ||
} | ||
|
||
public void setSingleton(Node singleton) { | ||
this.singleton = singleton; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.jruby.lexer.yacc; | ||
|
||
import org.jruby.ast.DefHolder; | ||
|
||
public class LexContext { | ||
// Is the parser currently within a class body. | ||
public boolean in_class; | ||
|
||
// Is the parser currently within a method definition | ||
public boolean in_def; | ||
|
||
public boolean in_defined; | ||
|
||
public boolean in_kwarg; | ||
|
||
public ShareableConstantValue shareable_constant_value; | ||
|
||
public void reset() { | ||
in_def = false; | ||
} | ||
|
||
public Object clone() { | ||
LexContext context = new LexContext(); | ||
context.in_class = in_class; | ||
context.in_def = in_def; | ||
context.in_defined = in_defined; | ||
context.shareable_constant_value = shareable_constant_value; | ||
|
||
return context; | ||
} | ||
|
||
public void restore(DefHolder holder) { | ||
this.in_def = holder.ctxt.in_def; | ||
this.shareable_constant_value = holder.ctxt.shareable_constant_value; | ||
} | ||
} |
Oops, something went wrong.