Skip to content

Commit

Permalink
Changes related to TISTUD-2679 Unhandled event loop exception Java he…
Browse files Browse the repository at this point in the history
…ap space crash and freeze when editing large file
  • Loading branch information
sgtcoolguy committed Nov 6, 2012
1 parent e6d73d6 commit 693b203
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 13 deletions.
Expand Up @@ -20,7 +20,7 @@ public class ERBScript extends ParseNode

public ERBScript(IRubyScript script, String startTag, String endTag)
{
super(IRubyConstants.CONTENT_TYPE_RUBY);
super();
fScript = script;
fStartTag = startTag;
fEndTag = endTag;
Expand All @@ -29,6 +29,11 @@ public ERBScript(IRubyScript script, String startTag, String endTag)
setLocation(script.getStartingOffset(), script.getEndingOffset());
}

public String getLanguage()
{
return IRubyConstants.CONTENT_TYPE_RUBY;
}

public String getStartTag()
{
return fStartTag;
Expand Down
@@ -1,6 +1,6 @@
/**
* Aptana Studio
* Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2005-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions).
* Please see the license.html included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
Expand All @@ -19,17 +19,12 @@
import com.aptana.parsing.ParseResult;
import com.aptana.parsing.WorkingParseResult;
import com.aptana.parsing.ast.IParseNode;
import com.aptana.parsing.ast.ParseNode;
import com.aptana.parsing.ast.ParseRootNode;
import com.aptana.ruby.core.IRubyConstants;
import com.aptana.ruby.core.IRubyScript;

public class RHTMLParser extends CompositeParser
{

// TODO Move to constants in parsing plugin and re-use
private static final ParseNode[] NO_PARSE_NODES = new ParseNode[0];

public RHTMLParser()
{
super(new RHTMLParserScanner(), IHTMLConstants.CONTENT_TYPE_HTML);
Expand All @@ -53,8 +48,7 @@ protected IParseNode processEmbeddedlanguage(IParseState parseState, WorkingPars
case ERBTokens.RUBY:
if (root == null)
{
root = new ParseRootNode(IRubyConstants.CONTENT_TYPE_RUBY, NO_PARSE_NODES, startingOffset,
startingOffset + source.length() - 1);
root = new RubyParseRootNode(startingOffset, startingOffset + source.length() - 1);
}
processRubyBlock(root);
break;
Expand Down Expand Up @@ -88,7 +82,8 @@ private void processRubyBlock(IParseNode root) throws IOException, beaver.Scanne
if (rubyRoot != null)
{
Symbol endTag = getCurrentSymbol();
ERBScript erb = new ERBScript((IRubyScript) rubyRoot, startTag.value.toString(), endTag.value.toString());
ERBScript erb = new ERBScript((IRubyScript) rubyRoot, startTag.value.toString(),
endTag.value.toString());
erb.setLocation(startTag.getStart(), endTag.getEnd());
root.addChild(erb);
}
Expand Down
@@ -0,0 +1,31 @@
/**
* Aptana Studio
* Copyright (c) 2005-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions).
* Please see the license.html included with this distribution for details.
* Any modifications to this file must keep this entire header intact.
*/
package com.aptana.editor.erb.html.parsing;

import beaver.Symbol;

import com.aptana.parsing.ast.ParseRootNode;
import com.aptana.ruby.core.IRubyConstants;

/**
* @author cwilliams
*/
public class RubyParseRootNode extends ParseRootNode
{

protected RubyParseRootNode(int start, int end)
{
super(new Symbol[0], start, end);
}

public String getLanguage()
{
return IRubyConstants.CONTENT_TYPE_RUBY;
}

}
Expand Up @@ -21,11 +21,16 @@ public class RubyComment extends ParseNode implements IRubyComment

public RubyComment(CommentNode commentNode, String text)
{
super(IRubyConstants.CONTENT_TYPE_RUBY);
super();
setLocation(commentNode.getPosition().getStartOffset(), commentNode.getPosition().getEndOffset());
this.text = text;
}

public String getLanguage()
{
return IRubyConstants.CONTENT_TYPE_RUBY;
}

@Override
public short getNodeType()
{
Expand Down
Expand Up @@ -24,15 +24,20 @@ public abstract class RubyElement extends ParseNode implements IRubyElement

protected RubyElement()
{
super(IRubyConstants.CONTENT_TYPE_RUBY);
super();
}

protected RubyElement(int start, int end)
{
super(IRubyConstants.CONTENT_TYPE_RUBY);
super();
this.setLocation(start, end);
}

public String getLanguage()
{
return IRubyConstants.CONTENT_TYPE_RUBY;
}

public String getName()
{
return EMPTY;
Expand Down

0 comments on commit 693b203

Please sign in to comment.