Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Falcon: Finished abstracting the syntax of an MXML document behind a …

…complete set of interfaces (IMXMLData, IMXMLTagData, IMXMLTagAttributeData, etc.) The other parts of the compiler now access the MXML document only through these interfaces rather than through the concrete classes.

git-svn-id: https://svn.apache.org/repos/asf/flex/falcon/trunk@1454275 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 658d9832c07623907ca22ad5b29c746911bd0ecb 1 parent 71312b7
Gordon Smith authored
Showing with 1,264 additions and 819 deletions.
  1. +2 −2 compiler/src/org/apache/flex/compiler/internal/parsing/as/BaseASParser.java
  2. +6 −6 compiler/src/org/apache/flex/compiler/internal/parsing/as/IncludeHandler.java
  3. +15 −15 compiler/src/org/apache/flex/compiler/internal/parsing/mxml/BalancingMXMLProcessor.java
  4. +16 −16 compiler/src/org/apache/flex/compiler/internal/parsing/mxml/MXMLScopeBuilder.java
  5. +23 −22 compiler/src/org/apache/flex/compiler/internal/parsing/mxml/MXMLTagDataDepth.java
  6. +5 −5 compiler/src/org/apache/flex/compiler/internal/parsing/mxml/MXMLTagDataPayload.java
  7. +5 −5 compiler/src/org/apache/flex/compiler/internal/parsing/mxml/MXMLUnitDataIterator.java
  8. +2 −2 compiler/src/org/apache/flex/compiler/internal/scopes/MXMLFileScope.java
  9. +6 −6 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLArrayNode.java
  10. +10 −10 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLClassReferenceNodeBase.java
  11. +2 −2 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLDeferredInstanceNode.java
  12. +2 −2 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLEventSpecifierNode.java
  13. +3 −3 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLExpressionNodeBase.java
  14. +10 −10 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLFileNode.java
  15. +6 −6 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLMetadataNode.java
  16. +2 −2 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLModelPropertyNode.java
  17. +28 −28 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBase.java
  18. +2 −2 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLPrivateNode.java
  19. +5 −5 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
  20. +6 −6 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLScriptNode.java
  21. +2 −2 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLSpecifierNodeBase.java
  22. +2 −2 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLStyleNode.java
  23. +2 −2 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLListNode.java
  24. +31 −30 compiler/src/org/apache/flex/compiler/internal/tree/mxml/XMLBuilder.java
  25. +33 −3 compiler/src/org/apache/flex/compiler/mxml/IMXMLData.java
  26. +3 −3 compiler/src/org/apache/flex/compiler/mxml/IMXMLDatabindingData.java
  27. +33 −0 compiler/src/org/apache/flex/compiler/mxml/IMXMLDatabindingValue.java
  28. +5 −4 compiler/src/org/apache/flex/compiler/mxml/IMXMLEntityData.java
  29. +33 −0 compiler/src/org/apache/flex/compiler/mxml/IMXMLEntityValue.java
  30. +31 −0 compiler/src/org/apache/flex/compiler/mxml/IMXMLInstructionData.java
  31. +39 −0 compiler/src/org/apache/flex/compiler/mxml/IMXMLNamespaceAttributeData.java
  32. +110 −5 compiler/src/org/apache/flex/compiler/mxml/IMXMLTagAttributeData.java
  33. +43 −0 compiler/src/org/apache/flex/compiler/mxml/IMXMLTagAttributeValue.java
  34. +36 −0 compiler/src/org/apache/flex/compiler/mxml/IMXMLTagBlobData.java
  35. +166 −15 compiler/src/org/apache/flex/compiler/mxml/IMXMLTagData.java
  36. +112 −55 compiler/src/org/apache/flex/compiler/mxml/IMXMLTextData.java
  37. +28 −0 compiler/src/org/apache/flex/compiler/mxml/IMXMLTextValue.java
  38. +165 −0 compiler/src/org/apache/flex/compiler/mxml/IMXMLUnitData.java
  39. +57 −85 compiler/src/org/apache/flex/compiler/mxml/MXMLData.java
  40. +2 −18 compiler/src/org/apache/flex/compiler/mxml/MXMLDatabindingData.java
  41. +3 −2 compiler/src/org/apache/flex/compiler/mxml/MXMLDatabindingValue.java
  42. +5 −4 compiler/src/org/apache/flex/compiler/mxml/MXMLEntityValue.java
  43. +2 −2 compiler/src/org/apache/flex/compiler/mxml/MXMLInstructionData.java
  44. +7 −10 compiler/src/org/apache/flex/compiler/mxml/MXMLNamespaceAttributeData.java
  45. +31 −79 compiler/src/org/apache/flex/compiler/mxml/MXMLTagAttributeData.java
  46. +4 −4 compiler/src/org/apache/flex/compiler/mxml/MXMLTagAttributeValue.java
  47. +3 −2 compiler/src/org/apache/flex/compiler/mxml/MXMLTagBlobData.java
  48. +66 −182 compiler/src/org/apache/flex/compiler/mxml/MXMLTagData.java
  49. +11 −32 compiler/src/org/apache/flex/compiler/mxml/MXMLTextData.java
  50. +3 −2 compiler/src/org/apache/flex/compiler/mxml/MXMLTextValue.java
  51. +34 −115 compiler/src/org/apache/flex/compiler/mxml/MXMLUnitData.java
  52. +2 −2 compiler/src/org/apache/flex/compiler/problems/MXMLUnexpectedDatabindingProblem.java
  53. +2 −2 compiler/src/org/apache/flex/compiler/problems/MXMLUnexpectedTextProblem.java
  54. +2 −2 compiler/src/org/apache/flex/compiler/problems/MXMLXMLRequireContentProblem.java
View
4 compiler/src/org/apache/flex/compiler/internal/parsing/as/BaseASParser.java
@@ -99,7 +99,7 @@
import org.apache.flex.compiler.internal.tree.as.VariableNode;
import org.apache.flex.compiler.internal.tree.as.metadata.MetaTagsNode;
import org.apache.flex.compiler.internal.workspaces.Workspace;
-import org.apache.flex.compiler.mxml.MXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
import org.apache.flex.compiler.problems.AttributesNotAllowedOnPackageDefinitionProblem;
import org.apache.flex.compiler.problems.CanNotInsertSemicolonProblem;
import org.apache.flex.compiler.problems.EmbedInitialValueProblem;
@@ -500,7 +500,7 @@ private static ICompilerProblem genericParserProblem(String path, int start, int
*/
public static ScopedBlockNode parseInlineScript(
final IFileNodeAccumulator fileNodeAccumulator,
- final MXMLTextData mxmlTextData,
+ final IMXMLTextData mxmlTextData,
final Collection<ICompilerProblem> problems,
final ASScope containingScope,
final IProjectConfigVariables variables,
View
12 compiler/src/org/apache/flex/compiler/internal/parsing/as/IncludeHandler.java
@@ -31,7 +31,7 @@
import org.apache.flex.compiler.filespecs.IFileSpecification;
import org.apache.flex.compiler.internal.parsing.mxml.MXMLScopeBuilder;
import org.apache.flex.compiler.internal.projects.CompilerProject;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
import org.apache.flex.compiler.projects.IASProject;
import org.apache.flex.compiler.units.ICompilationUnit;
import org.apache.flex.utils.FilenameNormalization;
@@ -228,7 +228,7 @@ public static IncludeHandler createForASTBuilding(
/**
* True if this {@code IncludeHandler} tracks not only {@link ASToken} but
- * also {@link MXMLUnitData}. This flag tells {@link #onNextToken(ASToken)}
+ * also {@link IMXMLUnitData}. This flag tells {@link #onNextToken(ASToken)}
* not to check whether {@code currentNode.tokenEnd} increases
* monotonically. Before CMP-1490 is fixed, this is a workaround for
* CMP-1368.
@@ -510,13 +510,13 @@ protected void onNextToken(ASToken token)
/**
* Update the {@code IncludeHandler}'s current offset counter with the next
- * {@code MXMLUnitData}
+ * {@code IMXMLUnitData}
*
- * @param unitData Next {@code MXMLUnitData} object.
+ * @param unitData Next {@code IMXMLUnitData} object.
*/
- public void onNextMXMLUnitData(final MXMLUnitData unitData)
+ public void onNextMXMLUnitData(final IMXMLUnitData unitData)
{
- assert unitData != null : "MXMLUnitData can't be null.";
+ assert unitData != null : "IMXMLUnitData can't be null.";
hasMXMLUnits = true;
if (currentNode != null)
View
30 compiler/src/org/apache/flex/compiler/internal/parsing/mxml/BalancingMXMLProcessor.java
@@ -28,14 +28,14 @@
import org.apache.flex.compiler.common.PrefixMap;
import org.apache.flex.compiler.filespecs.IFileSpecification;
-import org.apache.flex.compiler.mxml.MXMLData;
-import org.apache.flex.compiler.mxml.MXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
+import org.apache.flex.compiler.mxml.IMXMLData;
+import org.apache.flex.compiler.mxml.IMXMLTagData;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
import org.apache.flex.compiler.problems.ICompilerProblem;
/**
* The BalancingMXMLProcessor performs a balancing operation over a collection of
- * {@link MXMLTagData} objects. It looks for un-balanced MXML and attempts to
+ * {@link IMXMLTagData} objects. It looks for un-balanced MXML and attempts to
* add open and close tags in order to create a well-formed, or better-formed, DOM.
*
* The method used is to track tags by their depth, and going from inside out, to check for matches
@@ -60,17 +60,17 @@ public BalancingMXMLProcessor(IFileSpecification specification, Collection<IComp
* Initialize our balancing structures from a full MXMLUnitData array.
* @param data the array to use to populate our balancing structures
*/
- public void initialize(MXMLUnitData[] data) {
+ public void initialize(IMXMLUnitData[] data) {
int index = 0;
for(int i = 0; i < data.length; i++) {
- if(data[i] instanceof MXMLTagData) {
- if(!((MXMLTagData)data[i]).isEmptyTag()) {
- if( ((MXMLTagData)data[i]).isOpenTag()) {
- addOpenTag((MXMLTagData)data[i], index);
+ if(data[i] instanceof IMXMLTagData) {
+ if(!((IMXMLTagData)data[i]).isEmptyTag()) {
+ if( ((IMXMLTagData)data[i]).isOpenTag()) {
+ addOpenTag((IMXMLTagData)data[i], index);
index++;
} else {
index--;
- addCloseTag((MXMLTagData)data[i], index);
+ addCloseTag((IMXMLTagData)data[i], index);
}
}
}
@@ -81,7 +81,7 @@ public final void setFileSpecification(IFileSpecification specification) {
spec = specification;
}
- public MXMLUnitData[] balance(MXMLUnitData[] data, MXMLData mxmlData, Map<MXMLTagData, PrefixMap> map) {
+ public IMXMLUnitData[] balance(IMXMLUnitData[] data, IMXMLData mxmlData, Map<IMXMLTagData, PrefixMap> map) {
ArrayList<MXMLTagDataPayload> payload = new ArrayList<MXMLTagDataPayload>();
for(int i = depths.size() - 1; i >= 0 ; i--) {
boolean b = depths.get(i).balance(payload, map, mxmlData, data, problems, spec);
@@ -92,13 +92,13 @@ public final void setFileSpecification(IFileSpecification specification) {
Collections.sort(payload, Collections.reverseOrder());
if(payload.size() > 0) {
wasRepaired = true; // If any payload returned, then that also means repairing occurred
- List<MXMLUnitData> newTags = new ArrayList<MXMLUnitData>(Arrays.asList(data));
+ List<IMXMLUnitData> newTags = new ArrayList<IMXMLUnitData>(Arrays.asList(data));
for(int i = payload.size() - 1; i >=0; i--) {
MXMLTagDataPayload tokenPayload = payload.get(i);
newTags.add(tokenPayload.getPosition(), tokenPayload.getTagData());
}
- return newTags.toArray(new MXMLUnitData[0]);
+ return newTags.toArray(new IMXMLUnitData[0]);
}
return data;
}
@@ -127,12 +127,12 @@ private final MXMLTagDataDepth getDepth(int depth) {
return dep;
}
- public void addOpenTag(MXMLTagData openTag, int depth) {
+ public void addOpenTag(IMXMLTagData openTag, int depth) {
MXMLTagDataDepth dep = getDepth(depth);
dep.addOpenTag(openTag);
}
- public void addCloseTag(MXMLTagData closeTag, int depth) {
+ public void addCloseTag(IMXMLTagData closeTag, int depth) {
MXMLTagDataDepth dep = getDepth(depth);
dep.addCloseTag(closeTag);
}
View
32 compiler/src/org/apache/flex/compiler/internal/parsing/mxml/MXMLScopeBuilder.java
@@ -56,14 +56,14 @@
import org.apache.flex.compiler.internal.workspaces.Workspace;
import org.apache.flex.compiler.mxml.IMXMLData;
import org.apache.flex.compiler.mxml.IMXMLTagAttributeData;
-import org.apache.flex.compiler.mxml.IMXMLTextData.TextType;
import org.apache.flex.compiler.mxml.IMXMLLanguageConstants;
+import org.apache.flex.compiler.mxml.IMXMLTagAttributeValue;
import org.apache.flex.compiler.mxml.IMXMLTagData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLTextData.TextType;
import org.apache.flex.compiler.mxml.IMXMLTypeConstants;
-import org.apache.flex.compiler.mxml.MXMLNamespaceAttributeData;
-import org.apache.flex.compiler.mxml.MXMLTagAttributeValue;
-import org.apache.flex.compiler.mxml.MXMLTextData;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
+import org.apache.flex.compiler.mxml.IMXMLNamespaceAttributeData;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.problems.MXMLLibraryTagNotTheFirstChildProblem;
import com.google.common.collect.ImmutableSet;
@@ -269,14 +269,14 @@ private void processDefinitionTag(IMXMLTagData definitionTag)
int nameEnd = -1;
for (IMXMLTagAttributeData attr : definitionTagAttrs)
{
- if ((!(attr instanceof MXMLNamespaceAttributeData)) && (attr.hasValue()))
+ if ((!(attr instanceof IMXMLNamespaceAttributeData)) && (attr.hasValue()))
{
if ((attr.getURI() == null) && (ATTRIBUTE_NAME.equals(attr.getName())))
{
if (definitionName == null)
{
definitionName = attr.getRawValue();
- MXMLTagAttributeValue[] values = attr.getValues();
+ IMXMLTagAttributeValue[] values = attr.getValues();
nameStart = values[0].getAbsoluteStart() + 1; //attr.getValueStart();
nameEnd = values[values.length - 1].getAbsoluteEnd() - 1; // attr.getValueEnd();
}
@@ -324,7 +324,7 @@ private void processDefinitionTag(IMXMLTagData definitionTag)
private void processTag(IMXMLTagData tag)
{
- includeHandler.onNextMXMLUnitData((MXMLUnitData)tag);
+ includeHandler.onNextMXMLUnitData((IMXMLUnitData)tag);
boolean recurse = true;
@@ -489,11 +489,11 @@ private void processScriptTag(IMXMLTagData scriptTag)
else
{
final List<ScopedBlockNode> nodes = new ArrayList<ScopedBlockNode>(2);
- for (MXMLUnitData unit = scriptTag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
+ for (IMXMLUnitData unit = scriptTag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
{
- if (unit instanceof MXMLTextData)
+ if (unit instanceof IMXMLTextData)
{
- final MXMLTextData mxmlTextData = (MXMLTextData)unit;
+ final IMXMLTextData mxmlTextData = (IMXMLTextData)unit;
if (mxmlTextData.getTextType() != TextType.WHITESPACE)
{
final EnumSet<PostProcessStep> postProcess = EnumSet.of(
@@ -526,11 +526,11 @@ private void processMetadataTag(IMXMLTagData metadataTag)
{
assert fileScope.isMetadataTag(metadataTag);
- for (MXMLUnitData unit = metadataTag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
+ for (IMXMLUnitData unit = metadataTag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
{
- if (unit instanceof MXMLTextData)
+ if (unit instanceof IMXMLTextData)
{
- final MXMLTextData mxmlTextData = (MXMLTextData)unit;
+ final IMXMLTextData mxmlTextData = (IMXMLTextData)unit;
if (mxmlTextData.getTextType() != TextType.WHITESPACE)
{
MetaTagsNode metaTagNodes = ASParser.parseMetadata(project.getWorkspace(), mxmlTextData.getCompilableText(),
@@ -584,14 +584,14 @@ private void processComponentTag(IMXMLTagData componentTag)
int nameEnd = -1;
for (IMXMLTagAttributeData attr : definitionTagAttrs)
{
- if ((!(attr instanceof MXMLNamespaceAttributeData)) && (attr.hasValue()))
+ if ((!(attr instanceof IMXMLNamespaceAttributeData)) && (attr.hasValue()))
{
if ((attr.getURI() == null) && (attr.getName().equals("className")))
{
if (className == null)
{
className = attr.getRawValue();
- MXMLTagAttributeValue[] values = attr.getValues();
+ IMXMLTagAttributeValue[] values = attr.getValues();
nameStart = values[0].getAbsoluteStart() + 1; //attr.getValueStart();
nameEnd = values[values.length - 1].getAbsoluteEnd() - 1; // attr.getValueEnd();
}
View
45 compiler/src/org/apache/flex/compiler/internal/parsing/mxml/MXMLTagDataDepth.java
@@ -28,10 +28,11 @@
import org.apache.flex.compiler.common.PrefixMap;
import org.apache.flex.compiler.filespecs.IFileSpecification;
-import org.apache.flex.compiler.mxml.MXMLData;
-import org.apache.flex.compiler.mxml.MXMLTagAttributeData;
+import org.apache.flex.compiler.mxml.IMXMLData;
+import org.apache.flex.compiler.mxml.IMXMLTagData;
+import org.apache.flex.compiler.mxml.IMXMLTagAttributeData;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
import org.apache.flex.compiler.mxml.MXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
import org.apache.flex.compiler.parsing.MXMLTokenTypes;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.problems.SyntaxProblem;
@@ -44,12 +45,12 @@
*/
class MXMLTagDataDepth {
- private static final MXMLTagAttributeData[] MXML_TAG_ATTRIBUTE_DATAS = new MXMLTagAttributeData[0];
+ private static final IMXMLTagAttributeData[] MXML_TAG_ATTRIBUTE_DATAS = new IMXMLTagAttributeData[0];
- final class MXMLTagDataComparator implements Comparator<MXMLTagData> {
+ final class MXMLTagDataComparator implements Comparator<IMXMLTagData> {
@Override
- public final int compare(final MXMLTagData o1, final MXMLTagData o2)
+ public final int compare(final IMXMLTagData o1, final IMXMLTagData o2)
{
if(o1.getIndex() == o2.getIndex()) return 0;
if(o1.getIndex() < o2.getIndex()) return -1;
@@ -81,7 +82,7 @@ public String getRawAttributeValue(String attributeName)
}
@Override
- public MXMLTagAttributeData[] getAttributeDatas()
+ public IMXMLTagAttributeData[] getAttributeDatas()
{
//return empty array since our value for children is null
return MXML_TAG_ATTRIBUTE_DATAS;
@@ -96,29 +97,29 @@ public boolean isImplicit()
private MXMLTagDataDepth parent;
- private ArrayList<MXMLTagData> openTags;
- private FastStack<MXMLTagData> closeTags;
+ private ArrayList<IMXMLTagData> openTags;
+ private FastStack<IMXMLTagData> closeTags;
private int depth;
public MXMLTagDataDepth(int depth) {
this.depth = depth;
- openTags = new ArrayList<MXMLTagData>();
- closeTags = new FastStack<MXMLTagData>();
+ openTags = new ArrayList<IMXMLTagData>();
+ closeTags = new FastStack<IMXMLTagData>();
}
/**
* Adds an open tag to our list of tags we are tracking
- * @param openTag the {@link MXMLTagData} that is open
+ * @param openTag the {@link IMXMLTagData} that is open
*/
- public final void addOpenTag(final MXMLTagData openTag) {
+ public final void addOpenTag(final IMXMLTagData openTag) {
openTags.add(openTag);
}
/**
* Adds a close tag to our list of tags we are tracking
- * @param closeTag the {@link MXMLTagData} that is close
+ * @param closeTag the {@link IMXMLTagData} that is close
*/
- public final void addCloseTag(final MXMLTagData closeTag) {
+ public final void addCloseTag(final IMXMLTagData closeTag) {
closeTags.push(closeTag);
}
@@ -151,20 +152,20 @@ final void ensureOrder() {
* did_repair = ret | !payload.isEmpty()
*
*/
- public final boolean balance(List<MXMLTagDataPayload> payload, Map<MXMLTagData, PrefixMap> prefixMap, MXMLData mxmlData, MXMLUnitData[] data, Collection<ICompilerProblem> problems, IFileSpecification fileSpec) {
+ public final boolean balance(List<MXMLTagDataPayload> payload, Map<IMXMLTagData, PrefixMap> prefixMap, IMXMLData mxmlData, IMXMLUnitData[] data, Collection<ICompilerProblem> problems, IFileSpecification fileSpec) {
ensureOrder();
final int size = openTags.size();
boolean didNonPayloadRepair = false;
for(int i = 0; i < size; i++) {
- MXMLTagData openTag = openTags.get(i);
+ IMXMLTagData openTag = openTags.get(i);
if(!closeTags.isEmpty()) {
- final MXMLTagData closeTag = closeTags.peek();
+ final IMXMLTagData closeTag = closeTags.peek();
if(closeTag.getName().compareTo(openTag.getName()) != 0) {
//let's determine where to end, and then move all of our tags to our parent
int insertOffset = -1;
while(!closeTags.isEmpty()) {
- final MXMLTagData pop = closeTags.pop();
+ final IMXMLTagData pop = closeTags.pop();
if(pop.getName().compareTo(openTag.getName()) != 0) {
insertOffset = pop.getIndex();
if(parent != null) {
@@ -192,7 +193,7 @@ public final boolean balance(List<MXMLTagDataPayload> payload, Map<MXMLTagData,
{
// we have an open with no matching close, so let's just make
// it an empty tag. CMP-916
- openTag.setEmptyTag();
+ ((MXMLTagData)openTag).setEmptyTag();
didNonPayloadRepair = true; // note a repair, so we can alert caller
problems.add(produceProblemFromToken(openTag, fileSpec));
// TODO: below (line 230) the old code used to make up a new fake tag and
@@ -221,7 +222,7 @@ public final boolean balance(List<MXMLTagDataPayload> payload, Map<MXMLTagData,
int pos = openTag.getIndex();
int tokenSize = data.length;
while(pos < tokenSize) {
- MXMLUnitData currToken = data[pos];
+ IMXMLUnitData currToken = data[pos];
if(currToken instanceof MXMLTagData && !((MXMLTagData)currToken).hasExplicitCloseTag()) {
problems.add(new SyntaxProblem(currToken, ((MXMLTagData)currToken).getName()));
FakeMXMLTagData fakeMXMLTagData = new FakeMXMLTagData((MXMLTagData)currToken, true);
@@ -248,7 +249,7 @@ public final boolean balance(List<MXMLTagDataPayload> payload, Map<MXMLTagData,
return didNonPayloadRepair;
}
- private ICompilerProblem produceProblemFromToken(MXMLTagData tagData, IFileSpecification fileSpec)
+ private ICompilerProblem produceProblemFromToken(IMXMLTagData tagData, IFileSpecification fileSpec)
{
return new SyntaxProblem(tagData, tagData.getName());
}
View
10 compiler/src/org/apache/flex/compiler/internal/parsing/mxml/MXMLTagDataPayload.java
@@ -19,7 +19,7 @@
package org.apache.flex.compiler.internal.parsing.mxml;
-import org.apache.flex.compiler.mxml.MXMLTagData;
+import org.apache.flex.compiler.mxml.IMXMLTagData;
/**
* This class stores the new MXMLTagData object, as well as the index
@@ -28,19 +28,19 @@
*/
class MXMLTagDataPayload implements Comparable<MXMLTagDataPayload>{
- private MXMLTagData tagData;
+ private IMXMLTagData tagData;
private int offset;
- public MXMLTagDataPayload(MXMLTagData token, int position) {
+ public MXMLTagDataPayload(IMXMLTagData token, int position) {
offset = position;
tagData = token;
}
/**
- * @return the {@link MXMLTagData} that should be inserted into its parent
+ * @return the {@link IMXMLTagData} that should be inserted into its parent
* MXMLData object
*/
- public MXMLTagData getTagData() {
+ public IMXMLTagData getTagData() {
return tagData;
}
View
10 compiler/src/org/apache/flex/compiler/internal/parsing/mxml/MXMLUnitDataIterator.java
@@ -21,18 +21,18 @@
import java.util.Iterator;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
/**
* Faster iterator for dealing with MXMLUnitData objects
*/
-public class MXMLUnitDataIterator implements Iterator<MXMLUnitData> {
+public class MXMLUnitDataIterator implements Iterator<IMXMLUnitData> {
private int index = -1;
- private MXMLUnitData[] list;
+ private IMXMLUnitData[] list;
- public MXMLUnitDataIterator(MXMLUnitData[] list) {
+ public MXMLUnitDataIterator(IMXMLUnitData[] list) {
this.list = list;
}
@@ -43,7 +43,7 @@ public boolean hasNext() {
}
@Override
- public MXMLUnitData next() {
+ public IMXMLUnitData next() {
return list[index];
}
View
4 compiler/src/org/apache/flex/compiler/internal/scopes/MXMLFileScope.java
@@ -37,8 +37,8 @@
import org.apache.flex.compiler.internal.units.MXMLCompilationUnit;
import org.apache.flex.compiler.mxml.IMXMLData;
import org.apache.flex.compiler.mxml.IMXMLTagData;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
import org.apache.flex.compiler.mxml.IXMLNameResolver;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
import com.google.common.collect.ImmutableSet;
@@ -587,7 +587,7 @@ public boolean isReparentTag(IMXMLTagData tag)
return tagName.equals(reparentTagName);
}
- public boolean isScriptTag(MXMLUnitData unitData)
+ public boolean isScriptTag(IMXMLUnitData unitData)
{
if (unitData instanceof IMXMLTagData)
return isScriptTag((IMXMLTagData)unitData);
View
12 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLArrayNode.java
@@ -37,8 +37,8 @@
import org.apache.flex.compiler.internal.projects.FlexProject;
import org.apache.flex.compiler.internal.tree.as.NodeBase;
import org.apache.flex.compiler.mxml.IMXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.problems.MXMLIncompatibleArrayElementProblem;
import org.apache.flex.compiler.problems.MXMLUnexpectedTagProblem;
@@ -167,7 +167,7 @@ protected void processChildTag(MXMLTreeBuilder builder, IMXMLTagData tag,
@Override
protected void processChildWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
accumulateTextFragments(builder, text, info);
@@ -175,7 +175,7 @@ protected void processChildWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData
@Override
protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
accumulateTextFragments(builder, text, info);
@@ -211,7 +211,7 @@ private void processFragments(MXMLTreeBuilder builder, MXMLNodeInfo info)
}
void initializeDefaultProperty(MXMLTreeBuilder builder, IVariableDefinition defaultPropertyDefinition,
- List<MXMLUnitData> contentUnits)
+ List<IMXMLUnitData> contentUnits)
{
FlexProject project = builder.getProject();
@@ -222,7 +222,7 @@ void initializeDefaultProperty(MXMLTreeBuilder builder, IVariableDefinition defa
setClassReference(project, IASLanguageConstants.Array);
List<IMXMLNode> children = new ArrayList<IMXMLNode>();
- for (MXMLUnitData unit : contentUnits)
+ for (IMXMLUnitData unit : contentUnits)
{
if (unit instanceof IMXMLTagData)
{
View
20 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLClassReferenceNodeBase.java
@@ -39,8 +39,8 @@
import org.apache.flex.compiler.internal.tree.as.NodeBase;
import org.apache.flex.compiler.mxml.IMXMLTagAttributeData;
import org.apache.flex.compiler.mxml.IMXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.problems.MXMLDuplicateChildTagProblem;
import org.apache.flex.compiler.projects.ICompilerProject;
@@ -180,7 +180,7 @@
/**
* A list that accumulates content units for the default property.
*/
- private List<MXMLUnitData> defaultPropertyContentUnits;
+ private List<IMXMLUnitData> defaultPropertyContentUnits;
@Override
public IASNode getChild(int i)
@@ -521,10 +521,10 @@ private void processDefaultPropertyContentUnit(MXMLTreeBuilder builder,
info.addChildNode(defaultPropertyNode);
// Create a list in which we'll accumulate the tags for the default property.
- defaultPropertyContentUnits = new ArrayList<MXMLUnitData>(1);
+ defaultPropertyContentUnits = new ArrayList<IMXMLUnitData>(1);
}
- defaultPropertyContentUnits.add((MXMLUnitData)childTag);
+ defaultPropertyContentUnits.add((IMXMLUnitData)childTag);
}
/**
@@ -553,15 +553,15 @@ private void processNonDefaultPropertyContentUnit(MXMLTreeBuilder builder, MXMLN
int lastNonScriptTagIndex;
for (lastNonScriptTagIndex = (defaultPropertyContentUnits.size() - 1); lastNonScriptTagIndex > 0; --lastNonScriptTagIndex)
{
- MXMLUnitData unitData = defaultPropertyContentUnits.get(lastNonScriptTagIndex);
+ IMXMLUnitData unitData = defaultPropertyContentUnits.get(lastNonScriptTagIndex);
if (!builder.getFileScope().isScriptTag(unitData))
break;
}
assert lastNonScriptTagIndex >= 0;
assert lastNonScriptTagIndex < defaultPropertyContentUnits.size();
- List<MXMLUnitData> trailingScriptTags = defaultPropertyContentUnits.subList(lastNonScriptTagIndex + 1, defaultPropertyContentUnits.size());
- List<MXMLUnitData> defaultPropertyContentUnitsWithoutTrailingScriptTags =
+ List<IMXMLUnitData> trailingScriptTags = defaultPropertyContentUnits.subList(lastNonScriptTagIndex + 1, defaultPropertyContentUnits.size());
+ List<IMXMLUnitData> defaultPropertyContentUnitsWithoutTrailingScriptTags =
defaultPropertyContentUnits.subList(0, lastNonScriptTagIndex + 1);
// process the default property content units with the trailing
@@ -572,7 +572,7 @@ private void processNonDefaultPropertyContentUnit(MXMLTreeBuilder builder, MXMLN
builder, defaultPropertyDefinition, defaultPropertyContentUnitsWithoutTrailingScriptTags);
// Now create MXMLScriptNode's for all the trailing script tags.
- for (MXMLUnitData scriptTagData : trailingScriptTags)
+ for (IMXMLUnitData scriptTagData : trailingScriptTags)
{
assert builder.getFileScope().isScriptTag(scriptTagData);
MXMLScriptNode scriptNode = new MXMLScriptNode(this);
@@ -584,7 +584,7 @@ private void processNonDefaultPropertyContentUnit(MXMLTreeBuilder builder, MXMLN
@Override
protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
// Non-whitespace may be the value of a default property.
View
4 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLDeferredInstanceNode.java
@@ -31,7 +31,7 @@
import org.apache.flex.compiler.internal.projects.FlexProject;
import org.apache.flex.compiler.internal.tree.as.NodeBase;
import org.apache.flex.compiler.mxml.IMXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
import org.apache.flex.compiler.tree.ASTNodeID;
import org.apache.flex.compiler.tree.as.IASNode;
import org.apache.flex.compiler.tree.mxml.IMXMLClassNode;
@@ -107,7 +107,7 @@ protected void processChildTag(MXMLTreeBuilder builder, IMXMLTagData tag,
}
void initializeDefaultProperty(MXMLTreeBuilder builder, IVariableDefinition defaultPropertyDefinition,
- List<MXMLUnitData> contentUnits)
+ List<IMXMLUnitData> contentUnits)
{
FlexProject project = builder.getProject();
View
4 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLEventSpecifierNode.java
@@ -40,7 +40,7 @@
import org.apache.flex.compiler.internal.workspaces.Workspace;
import org.apache.flex.compiler.mxml.IMXMLTagAttributeData;
import org.apache.flex.compiler.mxml.IMXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.problems.MXMLEmptyEventHandlerProblem;
import org.apache.flex.compiler.scopes.IASScope;
@@ -188,7 +188,7 @@ protected void initializeFromAttribute(MXMLTreeBuilder builder,
*/
@Override
protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
// Don't report non-whitespace as a problem.
View
6 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLExpressionNodeBase.java
@@ -29,7 +29,7 @@
import org.apache.flex.compiler.internal.semantics.SemanticUtils;
import org.apache.flex.compiler.internal.tree.as.NodeBase;
import org.apache.flex.compiler.mxml.IMXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.problems.ImplicitCoercionToUnrelatedTypeProblem;
import org.apache.flex.compiler.projects.ICompilerProject;
@@ -113,14 +113,14 @@ public void initialize(MXMLTreeBuilder builder, ISourceLocation location,
@Override
protected void processChildWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text, MXMLNodeInfo info)
+ IMXMLTextData text, MXMLNodeInfo info)
{
accumulateTextFragments(builder, text, info);
}
@Override
protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text, MXMLNodeInfo info)
+ IMXMLTextData text, MXMLNodeInfo info)
{
info.hasDualContent = true;
View
20 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLFileNode.java
@@ -45,11 +45,11 @@
import org.apache.flex.compiler.internal.tree.as.ImportNode;
import org.apache.flex.compiler.internal.units.MXMLCompilationUnit;
import org.apache.flex.compiler.mxml.IMXMLData;
+import org.apache.flex.compiler.mxml.IMXMLInstructionData;
import org.apache.flex.compiler.mxml.IMXMLTagData;
import org.apache.flex.compiler.mxml.IMXMLTextData;
-import org.apache.flex.compiler.mxml.MXMLInstructionData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
+import org.apache.flex.compiler.mxml.IMXMLTextData.TextType;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.problems.MXMLConstructorHasParametersProblem;
import org.apache.flex.compiler.problems.MXMLContentAfterRootTagProblem;
@@ -169,12 +169,12 @@ private void processUnits(MXMLTreeBuilder builder)
return;
boolean foundRootTag = false;
- MXMLTextData asDoc = null;
+ IMXMLTextData asDoc = null;
// Walk the top-level units of the MXMLData.
- for (MXMLUnitData unit = mxmlData.getUnit(0); unit != null; unit = unit.getNextSiblingUnit())
+ for (IMXMLUnitData unit = mxmlData.getUnit(0); unit != null; unit = unit.getNextSiblingUnit())
{
- if (unit instanceof MXMLInstructionData)
+ if (unit instanceof IMXMLInstructionData)
{
if (unit.getStart() > 0)
{
@@ -195,10 +195,10 @@ else if (unit instanceof IMXMLTagData)
builder.addProblem(problem);
}
}
- else if (unit instanceof MXMLTextData)
+ else if (unit instanceof IMXMLTextData)
{
- MXMLTextData textData = (MXMLTextData)unit;
- if (textData.getTextType().equals(IMXMLTextData.TextType.ASDOC))
+ IMXMLTextData textData = (IMXMLTextData)unit;
+ if (textData.getTextType().equals(TextType.ASDOC))
asDoc = textData;
if (!builder.getMXMLDialect().isWhitespace(textData.getCompilableText()))
{
@@ -223,7 +223,7 @@ else if (unit instanceof MXMLTextData)
}
}
- private void processRootTag(MXMLTreeBuilder builder, IMXMLTagData rootTag, MXMLTextData asDoc)
+ private void processRootTag(MXMLTreeBuilder builder, IMXMLTagData rootTag, IMXMLTextData asDoc)
{
ClassDefinition fileDef = fileScope.getMainClassDefinition();
assert fileDef != null;
View
12 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLMetadataNode.java
@@ -24,9 +24,9 @@
import org.apache.flex.compiler.internal.tree.as.metadata.MetaTagsNode;
import org.apache.flex.compiler.mxml.IMXMLLanguageConstants;
import org.apache.flex.compiler.mxml.IMXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
import org.apache.flex.compiler.mxml.IMXMLTextData.TextType;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
import org.apache.flex.compiler.tree.ASTNodeID;
import org.apache.flex.compiler.tree.as.IASNode;
import org.apache.flex.compiler.tree.metadata.IMetaTagNode;
@@ -79,7 +79,7 @@ public String getName()
@Override
protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
// <fx:Metadata> allows metadata text, so don't do anything here.
@@ -90,11 +90,11 @@ protected void initializationComplete(MXMLTreeBuilder builder, IMXMLTagData tag,
MXMLNodeInfo info)
{
// Parse the event handling code.
- for (MXMLUnitData unit = tag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
+ for (IMXMLUnitData unit = tag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
{
- if (unit instanceof MXMLTextData)
+ if (unit instanceof IMXMLTextData)
{
- final MXMLTextData mxmlTextData = (MXMLTextData)unit;
+ final IMXMLTextData mxmlTextData = (IMXMLTextData)unit;
if (mxmlTextData.getTextType() != TextType.WHITESPACE)
{
MetaTagsNode metaTagsNode = ASParser.parseMetadata(builder.getWorkspace(),
View
4 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLModelPropertyNode.java
@@ -31,7 +31,7 @@
import org.apache.flex.compiler.internal.tree.as.NodeBase;
import org.apache.flex.compiler.mxml.IMXMLTagAttributeData;
import org.apache.flex.compiler.mxml.IMXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.tree.ASTNodeID;
import org.apache.flex.compiler.tree.as.IASNode;
@@ -120,7 +120,7 @@ protected void processTagSpecificAttribute(MXMLTreeBuilder builder, IMXMLTagData
@Override
protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
Collection<ICompilerProblem> problems = builder.getProblems();
View
56 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBase.java
@@ -48,13 +48,13 @@
import org.apache.flex.compiler.internal.tree.as.NodeBase;
import org.apache.flex.compiler.internal.tree.as.ScopedBlockNode;
import org.apache.flex.compiler.internal.workspaces.Workspace;
+import org.apache.flex.compiler.mxml.IMXMLData;
import org.apache.flex.compiler.mxml.IMXMLTagAttributeData;
-import org.apache.flex.compiler.mxml.IMXMLTextData.TextType;
+import org.apache.flex.compiler.mxml.IMXMLNamespaceAttributeData;
import org.apache.flex.compiler.mxml.IMXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLData;
-import org.apache.flex.compiler.mxml.MXMLNamespaceAttributeData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLTextData.TextType;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
import org.apache.flex.compiler.parsing.IASToken;
import org.apache.flex.compiler.parsing.IMXMLToken;
import org.apache.flex.compiler.parsing.MXMLTokenTypes;
@@ -274,7 +274,7 @@ protected void initializeFromTag(MXMLTreeBuilder builder, IMXMLTagData tag)
}
// Process each content unit.
- for (MXMLUnitData unit = tag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
+ for (IMXMLUnitData unit = tag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
{
processContentUnit(builder, tag, unit, info);
}
@@ -376,8 +376,8 @@ private void processAttribute(MXMLTreeBuilder builder, IMXMLTagData tag,
IMXMLTagAttributeData attribute,
MXMLNodeInfo info)
{
- if (attribute instanceof MXMLNamespaceAttributeData)
- processNamespaceAttribute(builder, tag, (MXMLNamespaceAttributeData)attribute);
+ if (attribute instanceof IMXMLNamespaceAttributeData)
+ processNamespaceAttribute(builder, tag, (IMXMLNamespaceAttributeData)attribute);
else if (isPrivateAttribute(attribute))
processPrivateAttribute(builder, tag, attribute);
@@ -401,11 +401,11 @@ else if (isPrivateAttribute(attribute))
* representing the attribute.
*/
private void processNamespaceAttribute(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLNamespaceAttributeData attribute)
+ IMXMLNamespaceAttributeData attribute)
{
String attributeURI = attribute.getNamespace();
- MXMLData mxmlData = attribute.getParent().getParent();
+ IMXMLData mxmlData = attribute.getParent().getParent();
String languageURI = mxmlData.getMXMLDialect().getLanguageNamespace();
if (MXMLDialect.isLanguageNamespace(attributeURI) &&
@@ -437,7 +437,7 @@ private static boolean isPrivateAttribute(IMXMLTagAttributeData attribute)
String tagURI = attribute.getParent().getURI();
- MXMLData mxmlData = attribute.getParent().getParent();
+ IMXMLData mxmlData = attribute.getParent().getParent();
MXMLDialect mxmlDialect = mxmlData.getMXMLDialect();
String languageURI = mxmlDialect.getLanguageNamespace();
@@ -514,14 +514,14 @@ protected void processTagSpecificAttribute(MXMLTreeBuilder builder, IMXMLTagData
* @param unit An {@code MXMLUnitData} object representing the content unit.
*/
private void processContentUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLUnitData unit,
+ IMXMLUnitData unit,
MXMLNodeInfo info)
{
if (unit instanceof IMXMLTagData)
processChildTag(builder, tag, (IMXMLTagData)unit, info);
- else if (unit instanceof MXMLTextData)
- processChildTextUnit(builder, tag, (MXMLTextData)unit, info);
+ else if (unit instanceof IMXMLTextData)
+ processChildTextUnit(builder, tag, (IMXMLTextData)unit, info);
}
/**
@@ -559,7 +559,7 @@ protected void processChildTag(MXMLTreeBuilder builder, IMXMLTagData tag,
* Subclasses do not need to override this method so it is private.
*/
private void processChildTextUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
switch (text.getTextType())
@@ -606,7 +606,7 @@ private void processChildTextUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
* unit.
*/
protected void processChildWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
}
@@ -624,7 +624,7 @@ protected void processChildWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData
* unit.
*/
protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
ICompilerProblem problem = new MXMLUnexpectedTextProblem(text);
@@ -633,7 +633,7 @@ protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagDa
/**
* Processes all the children of the given {@link IMXMLTagData} unit that are
- * {@link MXMLTextData} nodes. Each node will be processes separately, in
+ * {@link IMXMLTextData} nodes. Each node will be processes separately, in
* the order in which the appear in the document.
* <p>
* This method is only used by MXML AST building. To parse an ActionScript
@@ -641,7 +641,7 @@ protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagDa
*
* @param tag the {@link IMXMLTagData} to process
* @return a {@link List} of {@link ScopedBlockNode}s for each
- * {@link MXMLTextData} we encountered.
+ * {@link IMXMLTextData} we encountered.
*/
public static List<ScopedBlockNode> processUnitAsAS(
MXMLTreeBuilder builder,
@@ -653,11 +653,11 @@ protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagDa
{
assert buildOrReconnect == PostProcessStep.POPULATE_SCOPE || buildOrReconnect == PostProcessStep.RECONNECT_DEFINITIONS;
List<ScopedBlockNode> nodes = new ArrayList<ScopedBlockNode>(2);
- for (MXMLUnitData unit = tag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
+ for (IMXMLUnitData unit = tag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
{
- if (unit instanceof MXMLTextData)
+ if (unit instanceof IMXMLTextData)
{
- final MXMLTextData mxmlTextData = (MXMLTextData)unit;
+ final IMXMLTextData mxmlTextData = (IMXMLTextData)unit;
if (mxmlTextData.getTextType() != TextType.WHITESPACE)
{
final Workspace workspace = builder.getWorkspace();
@@ -728,7 +728,7 @@ public void setLocation(ISourceLocation location)
*
* @param unit The MXML unit from which this node was created.
*/
- protected void setLocation(MXMLUnitData unit)
+ protected void setLocation(IMXMLUnitData unit)
{
String sourcePath = unit.getSourcePath();
int start = unit.getAbsoluteStart();
@@ -771,19 +771,19 @@ protected void setLocation(IMXMLTagAttributeData attribute)
*
* @param units A list of MXML content units.
*/
- protected void setLocation(MXMLTreeBuilder builder, List<MXMLUnitData> units)
+ protected void setLocation(MXMLTreeBuilder builder, List<IMXMLUnitData> units)
{
int n = units.size();
- MXMLUnitData firstUnit = units.get(0);
- MXMLUnitData lastUnit = units.get(n - 1);
+ IMXMLUnitData firstUnit = units.get(0);
+ IMXMLUnitData lastUnit = units.get(n - 1);
// we only store the open tags in the units
// and the end offset should be the end of the last close tag
// check this here and fetch the end tag if the last tag is an open and non-empty tag
if (lastUnit instanceof IMXMLTagData && lastUnit.isOpenAndNotEmptyTag())
{
- MXMLUnitData endTag = (MXMLUnitData)((IMXMLTagData)lastUnit).findMatchingEndTag();
+ IMXMLUnitData endTag = (IMXMLUnitData)((IMXMLTagData)lastUnit).findMatchingEndTag();
if (endTag != null)
lastUnit = endTag;
}
@@ -804,7 +804,7 @@ protected void setLocation(MXMLTreeBuilder builder, List<MXMLUnitData> units)
* processing.
*/
protected void accumulateTextFragments(MXMLTreeBuilder builder,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
Collection<ICompilerProblem> problems = builder.getProblems();
View
4 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLPrivateNode.java
@@ -22,7 +22,7 @@
import org.apache.flex.compiler.internal.tree.as.NodeBase;
import org.apache.flex.compiler.mxml.IMXMLLanguageConstants;
import org.apache.flex.compiler.mxml.IMXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
import org.apache.flex.compiler.tree.ASTNodeID;
import org.apache.flex.compiler.tree.mxml.IMXMLPrivateNode;
@@ -63,7 +63,7 @@ protected void processChildTag(MXMLTreeBuilder builder, IMXMLTagData tag,
@Override
protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text, MXMLNodeInfo info)
+ IMXMLTextData text, MXMLNodeInfo info)
{
// Allow child text, but ignore it.
}
View
10 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLPropertySpecifierNode.java
@@ -38,8 +38,8 @@
import org.apache.flex.compiler.internal.tree.as.NodeBase;
import org.apache.flex.compiler.mxml.IMXMLTagAttributeData;
import org.apache.flex.compiler.mxml.IMXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.problems.MXMLUnresolvedTagProblem;
import org.apache.flex.compiler.tree.ASTNodeID;
@@ -261,7 +261,7 @@ private void processFragments(MXMLTreeBuilder builder,
*/
@Override
protected void initializeFromText(MXMLTreeBuilder builder,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
super.initializeFromText(builder, text, info);
@@ -273,7 +273,7 @@ protected void initializeFromText(MXMLTreeBuilder builder,
}
void initializeDefaultProperty(MXMLTreeBuilder builder, IVariableDefinition defaultPropertyDefinition,
- List<MXMLUnitData> contentUnits)
+ List<IMXMLUnitData> contentUnits)
{
FlexProject project = builder.getProject();
@@ -379,7 +379,7 @@ protected void processChildTag(MXMLTreeBuilder builder, IMXMLTagData tag,
*/
@Override
protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
accumulateTextFragments(builder, text, info);
View
12 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLScriptNode.java
@@ -43,8 +43,8 @@
import org.apache.flex.compiler.mxml.IMXMLLanguageConstants;
import org.apache.flex.compiler.mxml.IMXMLTagAttributeData;
import org.apache.flex.compiler.mxml.IMXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
import org.apache.flex.compiler.tree.ASTNodeID;
import org.apache.flex.compiler.tree.as.IASNode;
import org.apache.flex.compiler.tree.mxml.IMXMLScriptNode;
@@ -175,7 +175,7 @@ protected void processTagSpecificAttribute(MXMLTreeBuilder builder, IMXMLTagData
@Override
protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
info.hasDualContent = true;
@@ -213,11 +213,11 @@ protected void initializationComplete(MXMLTreeBuilder builder, IMXMLTagData tag,
{
// parse inline ActionScript
final List<ScopedBlockNode> scriptNodes = new ArrayList<ScopedBlockNode>();
- for (MXMLUnitData unit = tag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
+ for (IMXMLUnitData unit = tag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
{
- if (unit instanceof MXMLTextData)
+ if (unit instanceof IMXMLTextData)
{
- final MXMLTextData mxmlTextData = (MXMLTextData)unit;
+ final IMXMLTextData mxmlTextData = (IMXMLTextData)unit;
String text = mxmlTextData.getCompilableText();
if (!mxmlDialect.isWhitespace(text))
{
View
4 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLSpecifierNodeBase.java
@@ -22,7 +22,7 @@
import org.apache.flex.compiler.definitions.IDefinition;
import org.apache.flex.compiler.internal.tree.as.NodeBase;
import org.apache.flex.compiler.mxml.IMXMLTagAttributeData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
import org.apache.flex.compiler.tree.mxml.IMXMLSpecifierNode;
/**
@@ -167,7 +167,7 @@ protected void initializeFromAttribute(MXMLTreeBuilder builder,
* node start and end offset from local to absolute offsets.
*/
protected void initializeFromText(MXMLTreeBuilder builder,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
setLocation(text);
View
4 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLStyleNode.java
@@ -30,7 +30,7 @@
import org.apache.flex.compiler.mxml.IMXMLLanguageConstants;
import org.apache.flex.compiler.mxml.IMXMLTagAttributeData;
import org.apache.flex.compiler.mxml.IMXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.problems.MXMLDualContentProblem;
import org.apache.flex.compiler.tree.ASTNodeID;
@@ -124,7 +124,7 @@ protected void processTagSpecificAttribute(MXMLTreeBuilder builder, IMXMLTagData
@Override
protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
info.hasDualContent = true;
View
4 compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLListNode.java
@@ -22,7 +22,7 @@
import org.apache.flex.compiler.constants.IASLanguageConstants;
import org.apache.flex.compiler.internal.tree.as.NodeBase;
import org.apache.flex.compiler.mxml.IMXMLTagData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
+import org.apache.flex.compiler.mxml.IMXMLTextData;
import org.apache.flex.compiler.problems.MXMLXMLListMixedContentProblem;
import org.apache.flex.compiler.tree.ASTNodeID;
import org.apache.flex.compiler.tree.mxml.IMXMLXMLListNode;
@@ -83,7 +83,7 @@ protected void processChildTag(MXMLTreeBuilder builder, IMXMLTagData tag,
@Override
protected void processChildNonWhitespaceUnit(MXMLTreeBuilder builder, IMXMLTagData tag,
- MXMLTextData text,
+ IMXMLTextData text,
MXMLNodeInfo info)
{
builder.addProblem(new MXMLXMLListMixedContentProblem(tag));
View
61 compiler/src/org/apache/flex/compiler/internal/tree/mxml/XMLBuilder.java
@@ -29,8 +29,9 @@
import org.apache.flex.compiler.mxml.IMXMLTagAttributeData;
import org.apache.flex.compiler.mxml.IMXMLTagData;
import org.apache.flex.compiler.mxml.IMXMLTextData;
-import org.apache.flex.compiler.mxml.MXMLTextData;
-import org.apache.flex.compiler.mxml.MXMLUnitData;
+import org.apache.flex.compiler.mxml.IMXMLTextData.TextType;
+import org.apache.flex.compiler.mxml.IMXMLUnitData;
+import org.apache.flex.compiler.tree.mxml.IMXMLBindingNode;
import org.apache.flex.compiler.tree.mxml.IMXMLSingleDataBindingNode;
import java.io.StringWriter;
@@ -74,7 +75,7 @@ public XMLBuilder(MXMLInstanceNode parent, IMXMLTagData rootTag, PrefixMap exter
*/
Set<String> referencedPrefixes = new HashSet<String>();
- private List<MXMLBindingNode> databindings = new ArrayList<MXMLBindingNode>();
+ private List<IMXMLBindingNode> databindings = new ArrayList<IMXMLBindingNode>();
/**
* Process an MXMLTagData - this will write a String representation of the
@@ -115,7 +116,7 @@ void processNode(IMXMLTagData tag,
}
StringWriter childrenSW = new StringWriter();
- for (MXMLUnitData unit = tag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
+ for (IMXMLUnitData unit = tag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
{
processNode(unit, childrenSW);
}
@@ -188,7 +189,7 @@ else if (tag == rootTag)
}
/**
- * Process an MXMLTextData - this will write a String representation of the
+ * Process an IMXMLTextData - this will write a String representation of the
* tag into the StringWriter passed in. This will strip out any databinding
* expressions from the String. This will write out only CDATA and TEXT
* TextDatas Other kinds of text data are not output into the resulting XML
@@ -197,7 +198,7 @@ else if (tag == rootTag)
* those are (these are the expressions to set the value in the XML object
* when the TODO: PropertyChange event fires).
*/
- void processNode(MXMLTextData tag,
+ void processNode(IMXMLTextData tag,
StringWriter sw)
{
switch (tag.getTextType())
@@ -237,14 +238,14 @@ void processNode(MXMLTextData tag,
/**
* Generate an MXMLBindingNode to represent the binding expression in the
- * MXMLTextData passed in.
+ * IMXMLTextData passed in.
*
* @param tag the TextData that is the destination of the binding expression
* @param dbnode the DataBinding Node that contains the source expression
* @return An MXMLBindingNode with expressions for the source and
* destination
*/
- private MXMLBindingNode generateBindingNode(MXMLTextData tag, IMXMLSingleDataBindingNode dbnode)
+ private MXMLBindingNode generateBindingNode(IMXMLTextData tag, IMXMLSingleDataBindingNode dbnode)
{
return generateBindingNode(tag, null, dbnode);
}
@@ -275,7 +276,7 @@ private MXMLBindingNode generateBindingNode(IMXMLTagAttributeData attr, IMXMLSin
* @param dbnode The DataBindingNode that contains the source expression
* @return An MXMLBindingNode with the source and destination expressions
*/
- private MXMLBindingNode generateBindingNode(MXMLUnitData tag, IMXMLTagAttributeData attr, IMXMLSingleDataBindingNode dbnode)
+ private MXMLBindingNode generateBindingNode(IMXMLUnitData tag, IMXMLTagAttributeData attr, IMXMLSingleDataBindingNode dbnode)
{
// Build the destination expression
InstructionListNode destExpr = getTargetExprNode(tag, attr);
@@ -299,7 +300,7 @@ private MXMLBindingNode generateBindingNode(MXMLUnitData tag, IMXMLTagAttributeD
* @return An IMXMLDataBindingNode that was parsed from text, or null if no
* databinding expression was found
*/
- private IMXMLSingleDataBindingNode parseBindingExpression(MXMLTextData text)
+ private IMXMLSingleDataBindingNode parseBindingExpression(IMXMLTextData text)
{
Object o = MXMLDataBindingParser.parse(parent, text, text.getFragments(builder.getProblems()), builder.getProblems(), builder.getWorkspace(), builder.getMXMLDialect());
if (o instanceof IMXMLSingleDataBindingNode)
@@ -336,7 +337,7 @@ private IMXMLSingleDataBindingNode parseBindingExpression(IMXMLTagAttributeData
* @return An InstructionListNode that can be used as the destination
* expression for an MXMLBindingNode
*/
- private InstructionListNode getTargetExprNode(MXMLUnitData data, IMXMLTagAttributeData attr)
+ private InstructionListNode getTargetExprNode(IMXMLUnitData data, IMXMLTagAttributeData attr)
{
InstructionListNode expr = null;
InstructionList il = getTargetInstructions(data, attr);
@@ -361,10 +362,10 @@ private InstructionListNode getTargetExprNode(MXMLUnitData data, IMXMLTagAttribu
* @return An InstructionList that contains the instructions to set the
* target expression
*/
- private InstructionList getTargetInstructions(MXMLUnitData data, IMXMLTagAttributeData attr)
+ private InstructionList getTargetInstructions(IMXMLUnitData data, IMXMLTagAttributeData attr)
{
- MXMLUnitData d = data;
- Stack<MXMLUnitData> parentStack = new Stack<MXMLUnitData>();
+ IMXMLUnitData d = data;
+ Stack<IMXMLUnitData> parentStack = new Stack<IMXMLUnitData>();
if (isOnlyTextChild(d))
{
@@ -372,7 +373,7 @@ private InstructionList getTargetInstructions(MXMLUnitData data, IMXMLTagAttribu
// as that is what we'll be setting
d = d.getParentUnitData();
}
- MXMLUnitData target = d;
+ IMXMLUnitData target = d;
// push parents onto a stack, so we can walk down from the parent later
while (d != null)
@@ -389,7 +390,7 @@ private InstructionList getTargetInstructions(MXMLUnitData data, IMXMLTagAttribu
// except for the last one, which is the one we're targeting
while (parentStack.size() > 1)
{
- MXMLUnitData unitData = parentStack.pop();
+ IMXMLUnitData unitData = parentStack.pop();
if (unitData instanceof IMXMLTagData)
{
generateGetInstructions(il, (IMXMLTagData)unitData);
@@ -412,10 +413,10 @@ private InstructionList getTargetInstructions(MXMLUnitData data, IMXMLTagAttribu
generateSetInstructions(il, attr);
}
}
- else if (target instanceof MXMLTextData)
+ else if (target instanceof IMXMLTextData)
{
// We're targeting a TextData
- generateSetInstructions(il, (MXMLTextData)target);
+ generateSetInstructions(il, (IMXMLTextData)target);
}
return il;
@@ -496,7 +497,7 @@ private void generateSetInstructions(InstructionList il, IMXMLTagAttributeData a
* code will be in a function that has 1 argument, which is the new value,
* so we know it's passed in as the first local.
*/
- private void generateSetInstructions(InstructionList il, MXMLTextData text)
+ private void generateSetInstructions(InstructionList il, IMXMLTextData text)
{
il.addInstruction(ABCConstants.OP_callproperty, new Object[] {new Name("text"), 0});
il.addInstruction(ABCConstants.OP_getlocal1);
@@ -528,20 +529,20 @@ else if (d.getName().equals(tag.getName()))
* Get the index of a text data. Grabs the parent, and iterates it's
* children to find out what the index of the text data passed in should be
*/
- private int getIndexOfText(MXMLTextData text)
+ private int getIndexOfText(IMXMLTextData text)
{
- MXMLUnitData parent = text.getParentUnitData();
+ IMXMLUnitData parent = text.getParentUnitData();
IMXMLTagData parentTag = parent instanceof IMXMLTagData ? (IMXMLTagData)parent : null;
int index = 0;
if (parentTag != null)
{
- for (MXMLUnitData d = parentTag.getFirstChildUnit(); d != null; d = d.getNextSiblingUnit())
+ for (IMXMLUnitData d = parentTag.getFirstChildUnit(); d != null; d = d.getNextSiblingUnit())
{
if (d == text)
break;
- else if (d instanceof MXMLTextData && ((MXMLTextData)d).getTextType() == IMXMLTextData.TextType.CDATA)
+ else if (d instanceof IMXMLTextData && ((IMXMLTextData)d).getTextType() == TextType.CDATA)
++index;
}
}
@@ -553,11 +554,11 @@ else if (d instanceof MXMLTextData && ((MXMLTextData)d).getTextType() == IMXMLTe
* MXMLTagData This implies special, different processing from normal Text
* Datas.
*/
- private boolean isOnlyTextChild(MXMLUnitData child)
+ private boolean isOnlyTextChild(IMXMLUnitData child)
{
- if (child instanceof MXMLTextData && ((MXMLTextData)child).getTextType() == IMXMLTextData.TextType.TEXT)
+ if (child instanceof IMXMLTextData && ((IMXMLTextData)child).getTextType() == TextType.TEXT)
{
- MXMLUnitData p = child.getParentUnitData();
+ IMXMLUnitData p = child.getParentUnitData();
IMXMLTagData parent = p instanceof IMXMLTagData ? (IMXMLTagData)p : null;
if (parent != null)
{
@@ -688,15 +689,15 @@ private static String cleanupEscapedCharForXML(char escapedChar, String toClean)
return Collections.emptyList();
}
- void processNode(MXMLUnitData node, StringWriter sw)
+ void processNode(IMXMLUnitData node, StringWriter sw)
{
if (node instanceof IMXMLTagData)
processNode((IMXMLTagData)node, sw);
- else if (node instanceof MXMLTextData)
- processNode((MXMLTextData)node, sw);
+ else if (node instanceof IMXMLTextData)
+ processNode((IMXMLTextData)node, sw);
}
- public List<MXMLBindingNode> getDatabindings()
+ public List<IMXMLBindingNode> getDatabindings()
{
return databindings;
}
View
36 compiler/src/org/apache/flex/compiler/mxml/IMXMLData.java
@@ -21,13 +21,18 @@
import java.util.Collection;
+import org.apache.flex.compiler.common.PrefixMap;
import org.apache.flex.compiler.filespecs.IFileSpecification;
import org.apache.flex.compiler.internal.mxml.MXMLDialect;
import org.apache.flex.compiler.problems.ICompilerProblem;
/**
- * Encapsulation of an MXML file, with individual units for each open tag, close tag,
- * and block of text.
+ * Represents the syntax, but not the semantics, of an MXML file.
+ * <p>
+ * The file is represented as a sequence of "units",
+ * one for each open tag, close tag, and block of text.
+ * <p>
+ * No meaning is assigned to any tag, attribute, or text.
*/
public interface IMXMLData
{
@@ -51,6 +56,13 @@
* @return An {@code MXMLDialect}.
*/
MXMLDialect getMXMLDialect();
+
+ /**
+ * Get the MXML units found in this {@link IMXMLData}.
+ *
+ * @return An array of the {@link IMXMLUnitData}.
+ */
+ IMXMLUnitData[] getUnits();
/**
* Gets the number of MXML "units".
@@ -68,7 +80,7 @@
* @param i The index into the list of MXML units.
* @return The specified MXML unit, or <code>null</code> if the index is out of range.
*/
- MXMLUnitData getUnit(int i);
+ IMXMLUnitData getUnit(int i);
/**
* Gets the compiler problems found during the creation of this {@code MXMLData}.
@@ -88,4 +100,22 @@
* @return An {@code MXMLTagData} for the root tag.
*/
IMXMLTagData getRootTag();
+
+ /**
+ * Similar to findTagContainingOffset, but if the unit inside offset is a text node,
+ * will return the surrounding tag instead.
+ *
+ * @param offset offset
+ * @return the containing/surrounding tag, or null if one can not be found
+ */
+ IMXMLTagData findTagOrSurroundingTagContainingOffset(int offset);
+
+ /**
+ * Returns the PrefixMap for the given {@link IMXMLTagData}.
+ * This will not walk up the chain of prefix maps if this tag does not physically have uri->namespace mappings.
+ *
+ * @param data the {@link IMXMLTagData} to find the {@link PrefixMap} for
+ * @return a {@link PrefixMap} or null
+ */
+ PrefixMap getPrefixMapForData(IMXMLTagData data);
}
View
6 compiler/src/org/apache/flex/compiler/mxml/IMXMLDatabindingData.java
@@ -22,12 +22,12 @@
import org.apache.flex.compiler.parsing.IASToken;
/**
- * Represents an MXML databinding expression
+ * Represents a text unit which is an MXML databinding expression.
*/
-public interface IMXMLDatabindingData extends IMXMLTextData
+public interface IMXMLDatabindingData extends IMXMLUnitData
{
/**
- * Returns the tokens that are contained within this databinding expression
+ * Returns the tokens that are contained within this databinding expression.
*/
IASToken[] getDatabindingContent();
}
View
33 compiler/src/org/apache/flex/compiler/mxml/IMXMLDatabindingValue.java
@@ -0,0 +1,33 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.mxml;
+
+import org.apache.flex.compiler.parsing.IASToken;
+
+/**
+ * Represents an attribute value which is an MXML databinding expression.
+ */
+public interface IMXMLDatabindingValue extends IMXMLTagAttributeValue
+{
+ /**
+ * Returns the tokens that are contained within this databinding expression.
+ */
+ IASToken[] getDatabindingContent();
+}
View
9 compiler/src/org/apache/flex/compiler/mxml/IMXMLEntityData.java
@@ -20,13 +20,14 @@
package org.apache.flex.compiler.mxml;
/**
- * Represents an MXML entity encountered in MXML source
+ * Represents a text unit that is an XML entity.
*/
-public interface IMXMLEntityData
+public interface IMXMLEntityData extends IMXMLTextData
{
/**
- * Returns the in its decided form
- * @return the decoded entity, or null if a problem occurs
+ * Returns the entity in its decoded form.
+ *
+ * @return The decoded entity, or <code>null</code> if a problem occurs.
*/
String getDecodedContent();
}
View
33 compiler/src/org/apache/flex/compiler/mxml/IMXMLEntityValue.java
@@ -0,0 +1,33 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.mxml;
+
+/**
+ * Represents an attribute value which is an XML entity.
+ */
+public interface IMXMLEntityValue extends IMXMLTagAttributeValue
+{
+ /**
+ * Returns the entity in its decoded form.
+ *
+ * @return The decoded entity, or <code>null</code> if a problem occurs.
+ */
+ String getDecodedContent();
+}
View
31 compiler/src/org/apache/flex/compiler/mxml/IMXMLInstructionData.java
@@ -0,0 +1,31 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.mxml;
+
+/**
+ * Represents an XML processing instruction.
+ */
+public interface IMXMLInstructionData extends IMXMLUnitData
+{
+ /**
+ * Returns the raw processing instruction. It is up to clients to parse this.
+ */
+ String getInstructionText();
+}
View
39 compiler/src/org/apache/flex/compiler/mxml/IMXMLNamespaceAttributeData.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.mxml;
+
+/**
+ * Represents a namespace attribute in MXML.
+ */
+public interface IMXMLNamespaceAttributeData extends IMXMLTagAttributeData
+{
+ /**
+ * Returns the prefix found in this <code>xmlns</code> attribute.
+ * The prefix may be an empty string.
+ *
+ * @return A prefix, or an empty string.
+ */
+ String getNamespacePrefix();
+
+ /**
+ * Returns the namespace that this <code>xmlns</code> attribute represents.
+ */
+ String getNamespace();
+}
View
115 compiler/src/org/apache/flex/compiler/mxml/IMXMLTagAttributeData.java
@@ -22,46 +22,151 @@
import java.util.Collection;
import org.apache.flex.compiler.common.ISourceLocation;
+import org.apache.flex.compiler.common.XMLName;
import org.apache.flex.compiler.internal.mxml.MXMLDialect;
import org.apache.flex.compiler.internal.parsing.ISourceFragment;
import org.apache.flex.compiler.problems.ICompilerProblem;
/**
- * Encapsulation of a tag attribute in MXML.
+ * Represents an attribute in MXML.
*/
public interface IMXMLTagAttributeData extends ISourceLocation
{
+ /**
+ * Gets the MXML dialect used in the document containing this attribute.
+ *
+ * @return An {@link MXMLDialect} object.
+ */
MXMLDialect getMXMLDialect();
- MXMLTagData getParent();
+ /**
+ * Gets the tag to which this attribute belongs.
+ */
+ IMXMLTagData getParent();
+ /**
+ * Gets the name of this attribute as written, such as <code>"s:width.over"</code>.
+ *
+ * @return The complete attribute name, including a possible prefix and state.
+ */
+ String getName();
+
+ /**
+ * Gets the prefix of this attribute.
+ * <p>
+ * If the attribute does not have a prefix, this method returns <code>null</code>.
+ *
+ * @return The prefix as a String, or <code>null</code>.
+ */
String getPrefix();
+ /**
+ * Gets the URI of this attribute.
+ * <p>
+ * If the attribute does not have a prefix, this method returns
+ * <code>null</code>.
+ *
+ * @return The URI as a String, or <code>null</code>.
+ */
String getURI();
- String getName();
-
+ /**
+ * Gets the short name of this attribute, not including the prefix or state.
+ *
+ * @return The short attribute name as a <code>String</code>
+ */
String getShortName();
+ /**
+ * Gets the name of this attribute as an {@code XMLName}.
+ * <p>
+ * This takes into account the prefix but not the state.
+ *
+ * @return The attribute name as an {@code XMLName}.
+ */
+ XMLName getXMLName();
+
+ /**
+ * Gets the state name for this attribute.
+ *
+ * @return The state name as a <code>String</code>
+ */
String getStateName();
+ /**
+ * Returns <code>true</code> if this attribute has the specified short name
+ * and it either has no prefix or has a prefix that maps to the language
+ * URI.
+ *
+ * @return <code>true</code> or <code>false</code>.
+ */
boolean isSpecialAttribute(String name);
+ /**
+ * Returns <code>true</code> if this attribute has a value.
+ *
+ * @return <code>true</code> or <code>false</code>.
+ */
boolean hasValue();
- MXMLTagAttributeValue[] getValues();
+ /**
+ * Returns an array of {@code IMXMLTagAttributeValue} objects
+ * representing the various parts of value of this attribute.
+ *
+ * @return An array of {@code IMXMLTagAttributeValue} objects.
+ */
+ IMXMLTagAttributeValue[] getValues();
+ /**
+ * Gets the value of this attribute as a String.
+ * <p>
+ * The delimiting quotes are not included.
+ *
+ * @return The attribute value.
+ */
+ // TODO Rename this to getValue()
String getRawValue();
+ /**
+ * Gets the galue of this attribute as an array of source fragments.
+ *
+ * @param problems The collection of compiler problems to which problems are to be added.
+ * @return An array of source fragments.
+ */
ISourceFragment[] getValueFragments(Collection<ICompilerProblem> problems);
+ /**
+ * Gets the starting offset of the value of this attribute.
+ *
+ * @return The starting offset.
+ */
int getValueStart();
+ /**
+ * Gets the ending offset of the value of this attribute.
+ *
+ * @return The ending offset.
+ */
int getValueEnd();
+ /**
+ * Gets the line number of the start of the value of this attribute.
+ *
+ * @return The ending offset.
+ */
int getValueLine();
+ /**
+ * Gets the column number of the start of the value of this attribute.
+ *
+ * @return The ending offset.
+ */
int getValueColumn();
+ /**
+ * Gets the source location of the start of the value of this attribute.
+ *
+ * @return The sourced location.
+ */
ISourceLocation getValueLocation();
}
View
43 compiler/src/org/apache/flex/compiler/mxml/IMXMLTagAttributeValue.java
@@ -0,0 +1,43 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.mxml;
+
+import org.apache.flex.compiler.common.ISourceLocation;
+import org.apache.flex.compiler.mxml.IMXMLTextData.TextType;
+
+/**
+ * Represents an attribute value in MXML.
+ */
+public interface IMXMLTagAttributeValue extends ISourceLocation
+{
+ /**
+ * Gets the type of text for this part of the attribute value.
+ *
+ * @return A {@link TextType} value.
+ */
+ TextType getTextType();
+
+ /**
+ * Gets the content of thsi part of the attribute value.
+ *
+ * @return The content as a <code>String</code>.
+ */
+ String getContent();
+}
View
36 compiler/src/org/apache/flex/compiler/mxml/IMXMLTagBlobData.java
@@ -0,0 +1,36 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.mxml;
+
+/**
+ * Represents a blob of MXML.
+ * <p>
+ * An MXML blob is a large chunk of MXML data that was passed over during
+ * tokenization. A blob, for example could be the contents of an <code>&lt;fx:Private&gt; tag.
+ */
+public interface IMXMLTagBlobData extends IMXMLUnitData
+{
+ /**
+ * Gets the content of the blob.
+ *
+ * @return The blob's content as a <code>String</code>.
+ */
+ String getName();
+}
View
181 compiler/src/org/apache/flex/compiler/mxml/IMXMLTagData.java
@@ -22,57 +22,208 @@
import org.apache.flex.compiler.common.ISourceLocation;
import org.apache.flex.compiler.common.PrefixMap;
import org.apache.flex.compiler.common.XMLName;
-import org.apache.flex.compiler.filespecs.IFileSpecification;
-import org.apache.flex.compiler.internal.mxml.MXMLDialect;
/**
- * Encapsulation of an open tag, a close tag, or an empty tag in MXML.
+ * Represents an open tag, a close tag, or an empty tag in MXML.
*/
-public interface IMXMLTagData extends ISourceLocation
-{
- IFileSpecification getSource();
-
- MXMLDialect getMXMLDialect();
-
- IMXMLData getParent();
-
+public interface IMXMLTagData extends IMXMLUnitData
+{
+ /**
+ * Gets the tag that contains this tag.
+ * <p>
+ * If the document is not balanced before this tag, this method returns <code>null</code>.
+ *
+ * @return An {@code IMXMLTagData} object.
+ */
IMXMLTagData getParentTag();
+ /**
+ * Determines whether this tag is empty.
+ *
+ * @return <code>true</code> if it is.</code>
+ */
boolean isEmptyTag();
+ /**
+ * Determines whether this tag is a close tag.
+ *
+ * @return <code>true</code> if it is.</code>
+ */
boolean isCloseTag();
+ /**
+ * Determines whether this tag has an actual close tag,
+ * and was not closed as a post-process step of MXML repair.
+ *
+ * @return If we have an explicit close tag.
+ */
+ boolean hasExplicitCloseTag();
+
+ /**
+ * Gets the name of this tag as written, such as <code>"s:width.over"</code>.
+ *
+ * @return The complete tag name, including a possible prefix and state.
+ */
+ String getName();
+
+ /**
+ * Gets the prefix of this tag.
+ * <p>
+ * If the tag does not have a prefix, this method returns <code>null</code>.
+ *
+ * @return The prefix as a String, or <code>null</code>.
+ */
String getPrefix();
+ /**
+ * Gets the namespa