|
From: <caw...@us...> - 2007-06-21 18:55:14
|
Revision: 2663
http://svn.sourceforge.net/rubyeclipse/?rev=2663&view=rev
Author: cawilliams
Date: 2007-06-21 11:55:10 -0700 (Thu, 21 Jun 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java 2007-06-21 18:00:26 UTC (rev 2662)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java 2007-06-21 18:55:10 UTC (rev 2663)
@@ -36,11 +36,9 @@
}
final char[] contents = buffer == null ? null : buffer.getCharacters();
try {
- RubyParser parser = new RubyParser();
- Node node = parser.parse(null, new CharArrayReader(contents));
RubyScriptStructureBuilder visitor = new RubyScriptStructureBuilder(this, unitInfo, newElements);
SourceElementParser sp = new SourceElementParser(visitor);
- if (node != null) node.accept(sp);
+ sp.parse(contents, null);
unitInfo.setIsStructureKnown(true);
} catch (SyntaxException e) {
unitInfo.setIsStructureKnown(false);
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2007-06-21 18:00:26 UTC (rev 2662)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2007-06-21 18:55:10 UTC (rev 2663)
@@ -39,6 +39,7 @@
import org.eclipse.core.runtime.Path;
import org.jruby.ast.Node;
import org.jruby.ast.RootNode;
+import org.jruby.evaluator.Instruction;
import org.jruby.lexer.yacc.SyntaxException;
import org.rubypeople.rdt.core.CompletionRequestor;
import org.rubypeople.rdt.core.IBuffer;
@@ -133,12 +134,17 @@
Node ast = null;
try {
- RubyParser parser = new RubyParser();
- ast = parser.parse((IFile) getResource(), new CharArrayReader(contents));
- lastGoodAST = ast;
ISourceElementRequestor requestor = new RubyScriptStructureBuilder(this, unitInfo, newElements);
- SourceElementParser sp = new SourceElementParser(requestor);
- if (ast != null) ast.accept(sp);
+ SourceElementParser sp = new SourceElementParser(requestor){
+
+ @Override
+ public Instruction visitRootNode(RootNode iVisited) {
+ lastGoodAST = iVisited;
+ return super.visitRootNode(iVisited);
+ }
+ };
+ sp.parse(contents, null);
+ ast = lastGoodAST;
unitInfo.setIsStructureKnown(true);
} catch (SyntaxException e) {
unitInfo.setIsStructureKnown(false);
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java 2007-06-21 18:00:26 UTC (rev 2662)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java 2007-06-21 18:55:10 UTC (rev 2663)
@@ -92,6 +92,7 @@
private boolean inSingletonClass;
public ISourceElementRequestor requestor;
private boolean inModuleFunction;
+ private char[] source;
/**
*
@@ -529,6 +530,7 @@
public void parse(char[] source, char[] name) {
RubyParser p = new RubyParser();
+ this.source = source;
Node ast = p.parse(new String(source));
acceptNode(ast);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|