|
From: David C. <dc...@us...> - 2005-10-16 17:29:29
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12800/src/org/rubypeople/rdt/internal/core/parser Modified Files: RubyParser.java Log Message: Index all projects on plugin (eclipse) start. Index: RubyParser.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/RubyParser.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** RubyParser.java 1 Oct 2005 23:01:01 -0000 1.36 --- RubyParser.java 16 Oct 2005 17:29:21 -0000 1.37 *************** *** 1,10 **** /* ! * Created on Oct 6, 2004 */ package org.rubypeople.rdt.internal.core.parser; import java.io.Reader; import org.eclipse.core.resources.IFile; import org.jruby.ast.Node; import org.jruby.common.NullWarnings; --- 1,21 ---- /* ! * Author: Chris ! * ! * Copyright (c) 2005 RubyPeople. ! * ! * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. ! * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use ! * RDT except in compliance with the License. For further information see ! * org.rubypeople.rdt/rdt.license. */ + package org.rubypeople.rdt.internal.core.parser; + import java.io.InputStream; + import java.io.InputStreamReader; import java.io.Reader; import org.eclipse.core.resources.IFile; + import org.eclipse.core.runtime.CoreException; import org.jruby.ast.Node; import org.jruby.common.NullWarnings; *************** *** 15,18 **** --- 26,30 ---- import org.jruby.parser.RubyParserPool; import org.jruby.parser.RubyParserResult; + import org.rubypeople.rdt.internal.core.builder.IoUtils; /** *************** *** 30,37 **** public RubyParser(IRdtWarnings warnings) { ! this.warnings = warnings; ! this.pool = RubyParserPool.getInstance(); } ! public Node parse(IFile file, Reader content) { DefaultRubyParser parser = null; --- 42,49 ---- public RubyParser(IRdtWarnings warnings) { ! this.warnings = warnings; ! this.pool = RubyParserPool.getInstance(); } ! public Node parse(IFile file, Reader content) { DefaultRubyParser parser = null; *************** *** 39,43 **** try { warnings.setFile(file); ! parser = pool.borrowParser(); parser.setWarnings(warnings); parser.init(new RubyParserConfiguration()); --- 51,55 ---- try { warnings.setFile(file); ! parser = getDefaultRubyParser(); parser.setWarnings(warnings); parser.init(new RubyParserConfiguration()); *************** *** 52,55 **** --- 64,71 ---- } + protected DefaultRubyParser getDefaultRubyParser() { + return pool.borrowParser(); + } + public static void setDebugging(boolean b) { isDebug = b; *************** *** 60,68 **** } ! private static class NullRdtWarnings extends NullWarnings implements IRdtWarnings { public void setFile(IFile file) { } } } \ No newline at end of file --- 76,94 ---- } ! static class NullRdtWarnings extends NullWarnings implements IRdtWarnings { public void setFile(IFile file) { } } + public Node parse(IFile file) throws CoreException { + InputStream contents = null; + try { + contents = file.getContents(); + return parse(file, new InputStreamReader(contents)); + } finally { + IoUtils.closeQuietly(contents); + } + } + } \ No newline at end of file |