diff --git a/plugins/com.aptana.editor.erb/src/com/aptana/editor/erb/html/parsing/ERBScript.java b/plugins/com.aptana.editor.erb/src/com/aptana/editor/erb/html/parsing/ERBScript.java index 38d3f1f..10804b7 100644 --- a/plugins/com.aptana.editor.erb/src/com/aptana/editor/erb/html/parsing/ERBScript.java +++ b/plugins/com.aptana.editor.erb/src/com/aptana/editor/erb/html/parsing/ERBScript.java @@ -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; @@ -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; diff --git a/plugins/com.aptana.editor.erb/src/com/aptana/editor/erb/html/parsing/RHTMLParser.java b/plugins/com.aptana.editor.erb/src/com/aptana/editor/erb/html/parsing/RHTMLParser.java index 1e281ce..a43f47b 100644 --- a/plugins/com.aptana.editor.erb/src/com/aptana/editor/erb/html/parsing/RHTMLParser.java +++ b/plugins/com.aptana.editor.erb/src/com/aptana/editor/erb/html/parsing/RHTMLParser.java @@ -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. @@ -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); @@ -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; @@ -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); } diff --git a/plugins/com.aptana.editor.erb/src/com/aptana/editor/erb/html/parsing/RubyParseRootNode.java b/plugins/com.aptana.editor.erb/src/com/aptana/editor/erb/html/parsing/RubyParseRootNode.java new file mode 100644 index 0000000..6341413 --- /dev/null +++ b/plugins/com.aptana.editor.erb/src/com/aptana/editor/erb/html/parsing/RubyParseRootNode.java @@ -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; + } + +} diff --git a/plugins/com.aptana.ruby.core/src/com/aptana/ruby/internal/core/RubyComment.java b/plugins/com.aptana.ruby.core/src/com/aptana/ruby/internal/core/RubyComment.java index 8540411..6f010ac 100644 --- a/plugins/com.aptana.ruby.core/src/com/aptana/ruby/internal/core/RubyComment.java +++ b/plugins/com.aptana.ruby.core/src/com/aptana/ruby/internal/core/RubyComment.java @@ -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() { diff --git a/plugins/com.aptana.ruby.core/src/com/aptana/ruby/internal/core/RubyElement.java b/plugins/com.aptana.ruby.core/src/com/aptana/ruby/internal/core/RubyElement.java index fee3f4b..568c5e9 100644 --- a/plugins/com.aptana.ruby.core/src/com/aptana/ruby/internal/core/RubyElement.java +++ b/plugins/com.aptana.ruby.core/src/com/aptana/ruby/internal/core/RubyElement.java @@ -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;