flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gordonsm...@apache.org
Subject svn commit: r1441279 - in /flex/falcon/trunk/compiler/src/org/apache/flex/compiler: internal/parsing/mxml/ internal/scopes/ internal/tree/mxml/ internal/units/ mxml/
Date Fri, 01 Feb 2013 00:33:05 GMT
Author: gordonsmith
Date: Fri Feb  1 00:33:04 2013
New Revision: 1441279

URL: http://svn.apache.org/viewvc?rev=1441279&view=rev
Log:
Falcon: Introduced an IMXMLData interface. IMXMLDataManager nows deals in this interface rather
than the concrete MXMLData class.

Added:
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/IMXMLData.java   (with props)
Modified:
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/parsing/mxml/MXMLScopeBuilder.java
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/scopes/MXMLFileScope.java
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLFileNode.java
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLModelNode.java
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLTreeBuilder.java
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/units/MXMLCompilationUnit.java
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/IMXMLDataManager.java
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/MXMLData.java

Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/parsing/mxml/MXMLScopeBuilder.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/parsing/mxml/MXMLScopeBuilder.java?rev=1441279&r1=1441278&r2=1441279&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/parsing/mxml/MXMLScopeBuilder.java
(original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/parsing/mxml/MXMLScopeBuilder.java
Fri Feb  1 00:33:04 2013
@@ -54,10 +54,10 @@ import org.apache.flex.compiler.internal
 import org.apache.flex.compiler.internal.tree.mxml.MXMLNodeBase;
 import org.apache.flex.compiler.internal.units.MXMLCompilationUnit;
 import org.apache.flex.compiler.internal.workspaces.Workspace;
+import org.apache.flex.compiler.mxml.IMXMLData;
 import org.apache.flex.compiler.mxml.IMXMLTextData.TextType;
 import org.apache.flex.compiler.mxml.IMXMLLanguageConstants;
 import org.apache.flex.compiler.mxml.IMXMLTypeConstants;
-import org.apache.flex.compiler.mxml.MXMLData;
 import org.apache.flex.compiler.mxml.MXMLNamespaceAttributeData;
 import org.apache.flex.compiler.mxml.MXMLTagAttributeData;
 import org.apache.flex.compiler.mxml.MXMLTagAttributeValue;
@@ -84,7 +84,7 @@ public class MXMLScopeBuilder
     // RegEx for splitting implements="a.b.c , d.e.f"
     private static final String IMPLEMENTS_SPLITTER = "\\s\\,\\s";
 
-    public MXMLScopeBuilder(MXMLCompilationUnit compilationUnit, IFileSpecificationGetter
fileSpecGetter, MXMLData mxmlData, String qname, String fileName)
+    public MXMLScopeBuilder(MXMLCompilationUnit compilationUnit, IFileSpecificationGetter
fileSpecGetter, IMXMLData mxmlData, String qname, String fileName)
     {
         this.project = compilationUnit.getProject();
 
@@ -114,7 +114,7 @@ public class MXMLScopeBuilder
     }
 
     // The MXML for which we're building a file scope.
-    private MXMLData mxmlData;
+    private IMXMLData mxmlData;
 
     // Each project knows how to resolve MXML tags to ActionScript classes.
     // Different projects can resolve the same tag to different classes.

Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/scopes/MXMLFileScope.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/scopes/MXMLFileScope.java?rev=1441279&r1=1441278&r2=1441279&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/scopes/MXMLFileScope.java
(original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/scopes/MXMLFileScope.java
Fri Feb  1 00:33:04 2013
@@ -35,8 +35,8 @@ import org.apache.flex.compiler.internal
 import org.apache.flex.compiler.internal.mxml.MXMLDialect;
 import org.apache.flex.compiler.internal.projects.FlexProject;
 import org.apache.flex.compiler.internal.units.MXMLCompilationUnit;
+import org.apache.flex.compiler.mxml.IMXMLData;
 import org.apache.flex.compiler.mxml.IXMLNameResolver;
-import org.apache.flex.compiler.mxml.MXMLData;
 import org.apache.flex.compiler.mxml.MXMLTagData;
 import org.apache.flex.compiler.mxml.MXMLUnitData;
 
@@ -68,10 +68,10 @@ public class MXMLFileScope extends ASFil
      * resides.
      * @param filePath The path of the MXML file for which this file scope is
      * being constructed.
-     * @param mxmlData The {@code MXMLData} that built this file scope. This is
+     * @param mxmlData The {@code IMXMLData} that built this file scope. This is
      * used to determine which version of MXML is being used.
      */
-    public MXMLFileScope(MXMLCompilationUnit compilationUnit, String filePath, MXMLData mxmlData)
+    public MXMLFileScope(MXMLCompilationUnit compilationUnit, String filePath, IMXMLData
mxmlData)
     {
         super(compilationUnit.getProject().getWorkspace(), filePath);
 

Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLFileNode.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLFileNode.java?rev=1441279&r1=1441278&r2=1441279&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLFileNode.java
(original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLFileNode.java
Fri Feb  1 00:33:04 2013
@@ -44,8 +44,8 @@ import org.apache.flex.compiler.internal
 import org.apache.flex.compiler.internal.tree.as.FunctionNode;
 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.IMXMLTextData;
-import org.apache.flex.compiler.mxml.MXMLData;
 import org.apache.flex.compiler.mxml.MXMLInstructionData;
 import org.apache.flex.compiler.mxml.MXMLTagData;
 import org.apache.flex.compiler.mxml.MXMLTextData;
@@ -157,7 +157,7 @@ public class MXMLFileNode extends MXMLNo
 
     private void processUnits(MXMLTreeBuilder builder)
     {
-        MXMLData mxmlData = builder.getMXMLData();
+        IMXMLData mxmlData = builder.getMXMLData();
         
         // add problems that were encountered while parsing the data
         for (ICompilerProblem problem : mxmlData.getProblems())
@@ -466,7 +466,7 @@ public class MXMLFileNode extends MXMLNo
         String sourcePath = builder.getPath();
 
         MXMLCompilationUnit cu = builder.getCompilationUnit();
-        MXMLData mxmlData = builder.getMXMLData();
+        IMXMLData mxmlData = builder.getMXMLData();
 
         // Find the extents of the file node by finding the last bit
         // of the MXMLData. Note that this assumes that MXMLData

Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLModelNode.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLModelNode.java?rev=1441279&r1=1441278&r2=1441279&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLModelNode.java
(original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLModelNode.java
Fri Feb  1 00:33:04 2013
@@ -21,8 +21,8 @@ package org.apache.flex.compiler.interna
 
 import org.apache.flex.compiler.internal.projects.FlexProject;
 import org.apache.flex.compiler.internal.tree.as.NodeBase;
+import org.apache.flex.compiler.mxml.IMXMLData;
 import org.apache.flex.compiler.mxml.IMXMLLanguageConstants;
-import org.apache.flex.compiler.mxml.MXMLData;
 import org.apache.flex.compiler.mxml.MXMLTagAttributeData;
 import org.apache.flex.compiler.mxml.MXMLTagData;
 import org.apache.flex.compiler.problems.ICompilerProblem;
@@ -107,7 +107,7 @@ class MXMLModelNode extends MXMLInstance
             String sourcePath = resolveSourceAttributePath(builder, attribute, info);
             if (sourcePath != null)
             {
-                MXMLData mxmlData = builder.getExternalMXMLData(attribute, sourcePath);
+                IMXMLData mxmlData = builder.getExternalMXMLData(attribute, sourcePath);
                 if (mxmlData != null)
                 {
                     MXMLTagData rootTag = mxmlData.getRootTag();

Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLTreeBuilder.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLTreeBuilder.java?rev=1441279&r1=1441278&r2=1441279&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLTreeBuilder.java
(original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLTreeBuilder.java
Fri Feb  1 00:33:04 2013
@@ -54,8 +54,8 @@ import org.apache.flex.compiler.internal
 import org.apache.flex.compiler.internal.tree.as.NodeBase;
 import org.apache.flex.compiler.internal.units.MXMLCompilationUnit;
 import org.apache.flex.compiler.internal.workspaces.Workspace;
+import org.apache.flex.compiler.mxml.IMXMLData;
 import org.apache.flex.compiler.mxml.IMXMLDataManager;
-import org.apache.flex.compiler.mxml.MXMLData;
 import org.apache.flex.compiler.mxml.MXMLTagAttributeData;
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.problems.MXMLInvalidPercentageProblem;
@@ -127,7 +127,7 @@ public class MXMLTreeBuilder
     public MXMLTreeBuilder(MXMLCompilationUnit compilationUnit,
                            IFileSpecificationGetter fileSpecGetter,
                            String qname,
-                           MXMLData mxmlData,
+                           IMXMLData mxmlData,
                            MXMLFileScope fileScope,
                            Collection<ICompilerProblem> problems)
     {
@@ -160,7 +160,7 @@ public class MXMLTreeBuilder
 
     private final String path;
 
-    private final MXMLData mxmlData;
+    private final IMXMLData mxmlData;
 
     private final MXMLDialect mxmlDialect;
 
@@ -239,7 +239,7 @@ public class MXMLTreeBuilder
      * 
      * @return An {@code MXMLData} object.
      */
-    public MXMLData getMXMLData()
+    public IMXMLData getMXMLData()
     {
         return mxmlData;
     }
@@ -795,18 +795,18 @@ public class MXMLTreeBuilder
     }
 
     /**
-     * Gets the {@link MXMLData} representation of an external file specified by
+     * Gets the {@link IMXMLData} representation of an external file specified by
      * a <code>source</code> attribute.
      * 
      * @param sourceAttribute The {@link MXMLTagAttributeData} representing the
      * <code>source</code> attribute.
      * @param resolvedSourcePath The path to the file specified by the attribute,
      * resolved and normalized.
-     * @return A {@link MXMLData} object representing the contents of the file,
+     * @return An {@link IMXMLData} object representing the contents of the file,
      * or <code>null</code> if the file does not exist or cannot be read.
      */
-    public MXMLData getExternalMXMLData(MXMLTagAttributeData sourceAttribute,
-                                        String resolvedSourcePath)
+    public IMXMLData getExternalMXMLData(MXMLTagAttributeData sourceAttribute,
+                                         String resolvedSourcePath)
     {
         File file = new File(resolvedSourcePath);
 

Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/units/MXMLCompilationUnit.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/units/MXMLCompilationUnit.java?rev=1441279&r1=1441278&r2=1441279&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/units/MXMLCompilationUnit.java
(original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/units/MXMLCompilationUnit.java
Fri Feb  1 00:33:04 2013
@@ -42,8 +42,8 @@ import org.apache.flex.compiler.internal
 import org.apache.flex.compiler.internal.units.requests.ASFileScopeRequestResult;
 import org.apache.flex.compiler.internal.units.requests.SWFTagsRequestResult;
 import org.apache.flex.compiler.internal.units.requests.SyntaxTreeRequestResult;
+import org.apache.flex.compiler.mxml.IMXMLData;
 import org.apache.flex.compiler.mxml.IMXMLDataManager;
-import org.apache.flex.compiler.mxml.MXMLData;
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.problems.UnexpectedExceptionProblem;
 import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
@@ -90,7 +90,7 @@ public class MXMLCompilationUnit extends
         
         startProfile(Operation.GET_SYNTAX_TREE);
         
-        final MXMLData mxmlData = getMXMLData();
+        final IMXMLData mxmlData = getMXMLData();
         
         final Collection<ICompilerProblem> problems = new HashSet<ICompilerProblem>();
         
@@ -164,7 +164,7 @@ public class MXMLCompilationUnit extends
         startProfile(Operation.GET_FILESCOPE);
         try
         {
-            final MXMLData mxmlData = getMXMLData();
+            final IMXMLData mxmlData = getMXMLData();
                     
             final MXMLScopeBuilder scopeBuilder = new MXMLScopeBuilder(this, getFileSpecificationGetter(),
mxmlData, qname, getAbsoluteFilename());
             MXMLFileScope fileScope = scopeBuilder.build();
@@ -270,14 +270,14 @@ public class MXMLCompilationUnit extends
         }
     }
     
-    private MXMLData getMXMLData()
+    private IMXMLData getMXMLData()
     {
         // Get the DOM-like MXMLData for the file.
         // If its not already in the Workspace's MXMLDataManager,
         // the MXML file will be parsed.
         final IMXMLDataManager mxmlDataManager = getProject().getWorkspace().getMXMLDataManager();
         final IFileSpecification rootFileSpec = getRootFileSpecification();
-        final MXMLData mxmlData = mxmlDataManager.get(rootFileSpec);
+        final IMXMLData mxmlData = mxmlDataManager.get(rootFileSpec);
         return mxmlData;
     }
     

Added: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/IMXMLData.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/IMXMLData.java?rev=1441279&view=auto
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/IMXMLData.java (added)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/IMXMLData.java Fri Feb  1
00:33:04 2013
@@ -0,0 +1,83 @@
+/*
+ *
+ *  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 java.util.Collection;
+
+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.
+ */
+public interface IMXMLData
+{
+    /**
+     * Gets the  path to the file on disk that created this {@link MXMLData}.
+     *
+     * @return The path as a {@code String}.
+     */
+    String getPath();
+        
+    /**
+     * Gets the MXML dialect being used.
+     * 
+     * @return An {@code MXMLDialect}.
+     */
+    MXMLDialect getMXMLDialect();
+
+    /**
+     * Gets the number of MXML "units".
+     * <p>
+     * Each unit represents an open tag, a close tag, a block of text, etc.
+     * 
+     * @return The number of {@code MXMLUnitData} objects you can retrieve with
+     * {@code getUnit()}.
+     */
+    int getNumUnits();
+    
+    /**
+     * Gets an MXML unit by index.
+     * 
+     * @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);
+    
+    /**
+     * Gets the compiler problems found during the creation of this {@code MXMLData}.
+     * 
+     * @return A collection of {@code ICompilerProblem} objects.
+     */
+    Collection<ICompilerProblem> getProblems();
+    
+    /**
+     * Gets the ending offset of the last unit.
+     */
+    int getEnd();
+    
+    /**
+     * Gets the root tag.
+     * 
+     * @return An {@code MXMLTagData} for the root tag. 
+     */
+    MXMLTagData getRootTag();
+}

Propchange: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/IMXMLData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/IMXMLDataManager.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/IMXMLDataManager.java?rev=1441279&r1=1441278&r2=1441279&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/IMXMLDataManager.java (original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/IMXMLDataManager.java Fri
Feb  1 00:33:04 2013
@@ -23,7 +23,7 @@ import org.apache.flex.compiler.filespec
 
 /**
  * The {@code IMXMLDataManager} of the {@code IWorkspace} maintains a cache
- * of {@code MXMLData} objects that serve as DOMs for MXML files.
+ * of {@code IMXMLData} objects that serve as DOMs for MXML files.
  * <p>
  * If an MXML file is used in multiple projects, its {@code MXMLData}
  * can be shared. Its symbol table and parse tree cannot be shared,
@@ -33,21 +33,21 @@ import org.apache.flex.compiler.filespec
 public interface IMXMLDataManager
 {
     /**
-     * Get the {@code MXMLData} for the specified MXML file.
-     * If the manager already has the {@code MXMLData} for the file, it returns it.
-     * Otherwise, it will parse the MXML file, store the {@code MXMLData}, and return it.
+     * Gets the {@code IMXMLData} for the specified MXML file.
+     * If the manager already has the {@code IMXMLData} for the file, it returns it.
+     * Otherwise, it will parse the MXML file, store the {@code IMXMLData}, and return it.
      * 
      * @param fileSpec An {@code IFileSpecification} object specifying an MXML file.
      * 
-     * @return An {@code MXMLData} object representing
+     * @return An {@code IMXMLData} object representing
      * the tags, attributes, and text in the MXML file.
      */
-    MXMLData get(IFileSpecification fileSpec);
+    IMXMLData get(IFileSpecification fileSpec);
     
     /**
-     * Removes any cache'd {@link MXMLData}'s for the specified
-     * file.
-     * @param fileSpec
+     * Removes any cached {@link IMXMLData} objects for the specified file.
+     * 
+     * @param fileSpec An {@code IFileSpecification} for the file being invalidated.
      */
     void invalidate(IFileSpecification fileSpec);
 }

Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/MXMLData.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/MXMLData.java?rev=1441279&r1=1441278&r2=1441279&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/MXMLData.java (original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/mxml/MXMLData.java Fri Feb  1
00:33:04 2013
@@ -51,7 +51,7 @@ import org.apache.flex.utils.FastStack.I
  * Encapsulation of an MXML file, with individual units for each open tag, close tag,
  * and block of text.
  */
-public class MXMLData {
+public class MXMLData implements IMXMLData {
 
     private final class TokenizerPayload {
         private List<MXMLToken> tokens;



Mime
View raw message