flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cd...@apache.org
Subject [05/51] [partial] - Migrated the directory structure to a more Maven style structure. - Started migrating the Parser from Antlr2+3 and JFlex to Antlr4.
Date Tue, 22 Jul 2014 13:35:31 GMT
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java
new file mode 100644
index 0000000..aef9e94
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/TargetSettings.java
@@ -0,0 +1,571 @@
+/*
+ *
+ *  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.internal.config;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.apache.commons.io.FileUtils;
+
+import org.apache.flex.compiler.config.Configuration;
+import org.apache.flex.compiler.config.Configurator;
+import org.apache.flex.compiler.config.RSLSettings;
+import org.apache.flex.compiler.internal.projects.LibraryPathManager;
+import org.apache.flex.compiler.targets.ITargetSettings;
+import org.apache.flex.utils.FilenameNormalization;
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Value object of ITargetSettings.
+ * 
+ * The only way to create an instance of this object is by calling
+ * Configurator.getTargetSettings;
+ */
+public class TargetSettings implements ITargetSettings
+{
+    public TargetSettings(Configuration configuration)
+    {
+        this.configuration = configuration;
+    }
+
+    private File output;
+    private File defaultCSS;
+    
+    private List<File> themes;
+    private Collection<File> externalLibraryPath;
+    private Collection<File> includeLibraries;
+    private List<RSLSettings> rslLibraryPath;
+    private Set<File> includeSources;
+    private Map<String, File> includeFiles;
+    
+    private final Configuration configuration;
+    
+    private Set<String> externalLinkageLibraries;
+    
+    /**
+     * @return the accessible
+     */
+    @Override
+    public boolean isAccessible()
+    {
+        return configuration.getCompilerAccessible();
+    }
+
+    /**
+     * @return the debugEnabled
+     */
+    @Override
+    public boolean isDebugEnabled()
+    {
+        return configuration.isDebuggingEnabled();
+    }
+
+    /**
+     * @return the optimized
+     */
+    @Override
+    public boolean isOptimized()
+    {
+        return configuration.getCompilerOptimize();
+    }
+
+    /**
+     * @return the compressed
+     */
+    @Override
+    public boolean useCompression()
+    {
+        return configuration.useCompression();
+    }
+
+    /**
+     * @return the verboseStacktracesEnabled
+     */
+    @Override
+    public boolean areVerboseStacktracesEnabled()
+    {
+        return configuration.debug();
+    }
+
+    /**
+     * @return the keepAllTypeSelectors
+     */
+    @Override
+    public boolean keepAllTypeSelectors()
+    {
+        return configuration.keepAllTypeSelectors();
+    }
+
+    /**
+     * @return the useNetwork
+     */
+    @Override
+    public boolean useNetwork()
+    {
+        return configuration.getUseNetwork();
+    }
+
+    /**
+     * @return the removeUnusedRuntimeSharedLibraryPaths
+     */
+    @Override
+    public boolean removeUnusedRuntimeSharedLibraryPaths()
+    {
+        return configuration.getRemoveUnusedRsls();
+    }
+
+    /**
+     * @return the verifyDigests
+     */
+    @Override
+    public boolean verifyDigests()
+    {
+        return configuration.getVerifyDigests();
+    }
+
+    /**
+     * @return the useResourceBundleMetadata
+     */
+    @Override
+    public boolean useResourceBundleMetadata()
+    {
+        return true; // TODO: not implemented in configuration
+    }
+
+    /**
+     * @return the includeLookupOnlyEnabled
+     */
+    @Override
+    public boolean isIncludeLookupOnlyEnabled()
+    {
+        return configuration.getIncludeLookupOnly();
+    }
+
+    /**
+     * @return the defaultBackgroundColor
+     */
+    @Override
+    public int getDefaultBackgroundColor()
+    {
+        return configuration.getDefaultBackgroundColor();
+    }
+
+    /**
+     * @return the defaultFrameRate
+     */
+    @Override
+    public int getDefaultFrameRate()
+    {
+        return configuration.getDefaultFrameRate();
+    }
+
+    /**
+     * @return whether default script limits are set
+     */
+    @Override
+    public boolean areDefaultScriptLimitsSet()
+    {
+        return configuration.scriptLimitsSet();
+    }
+
+    /**
+     * @return the defaultScriptTimeLimit
+     */
+    @Override
+    public int getDefaultScriptTimeLimit()
+    {
+        return configuration.getScriptTimeLimit();
+    }
+
+    /**
+     * @return the defaultScriptRecursionLimit
+     */
+    @Override
+    public int getDefaultScriptRecursionLimit()
+    {
+        return configuration.getScriptRecursionLimit();
+    }
+
+    /**
+     * @return the defaultWidth
+     */
+    @Override
+    public int getDefaultWidth()
+    {
+        return configuration.getDefaultWidth();
+    }
+
+    /**
+     * @return the defaultHeight
+     */
+    @Override
+    public int getDefaultHeight()
+    {
+        return configuration.getDefaultHeight();
+    }
+
+    /**
+     * @return the output
+     */
+    @Override
+    public File getOutput()
+    {
+        if (output == null)
+            output = FilenameNormalization.normalize(new File(configuration.getOutput()));
+        
+        return output;
+    }
+
+    /**
+     * @return the actionScriptMetadataNames
+     */
+    @Override
+    public Collection<String> getASMetadataNames()
+    {
+        return configuration.getCompilerKeepAs3Metadata();
+    }
+
+    /**
+     * @return the defaultCSS
+     */
+    @Override
+    public File getDefaultCSS()
+    {
+        if (defaultCSS == null)
+            defaultCSS = FilenameNormalization.normalize(new File(configuration.getCompilerDefaultsCssUrl()));
+        
+        return defaultCSS;
+    }
+
+    /**
+     * @return the externs
+     */
+    @Override
+    public Collection<String> getExterns()
+    {
+        return configuration.getExterns();
+    }
+
+    /**
+     * @return the implicitImports for MXML
+     */
+    @Override
+    public String[] getMxmlImplicitImports()
+    {
+        return configuration.getCompilerMxmlImplicitImports();
+    }
+
+    /**
+     * @return the includes
+     */
+    @Override
+    public Collection<String> getIncludes()
+    {
+        return configuration.getIncludes();
+    }
+
+    /**
+     * @return the frameLabels
+     */
+    @Override
+    public List<FrameInfo> getFrameLabels()
+    {
+        return configuration.getFrameList();
+    }
+
+    /**
+     * @return the swfMetadata
+     */
+    @Override
+    public String getSWFMetadata()
+    {
+        return configuration.getRawMetadata();
+    }
+
+    /**
+     * @return the SWF version
+     */
+    @Override
+    public int getSWFVersion()
+    {
+        return configuration.getSwfVersion();
+    }
+
+    /**
+     * @return the preloader class name
+     */
+    @Override
+    public String getPreloaderClassName()
+    {
+        return configuration.getPreloader();
+    }
+    
+    
+
+    @Override
+    public String getRootSourceFileName()
+    {
+        return configuration.getTargetFile();
+    }
+
+    /**
+     * @return the rootClassName
+     */
+    @Override
+    public String getRootClassName()
+    {
+        return configuration.getMainDefinition();
+    }
+
+    /**
+     * @return the themes
+     */
+    @Override
+    public List<File> getThemes()
+    {
+        if (themes == null)
+            themes = Configurator.toFileList(configuration.getCompilerThemeFiles());
+        
+        return themes;
+    }
+
+    /**
+     * @return the externalLibraryPath
+     */
+    @Override
+    public Collection<File> getExternalLibraryPath()
+    {
+        if (externalLibraryPath == null)
+        {
+            List<File> files = Configurator.toFileList(configuration.getCompilerExternalLibraryPath());
+            Set<File> expandedFiles = LibraryPathManager.discoverSWCFilePathsAsFiles(files.toArray(new File[files.size()]));
+
+            externalLibraryPath = new ArrayList<File>(expandedFiles.size());
+            for (File swcFile : expandedFiles)
+                externalLibraryPath.add(swcFile);
+        }
+
+        return externalLibraryPath;
+    }
+
+    /**
+     * @return the includeLibraries
+     */
+    @Override
+    public Collection<File> getIncludeLibraries()
+    {
+        if (includeLibraries == null)
+            includeLibraries = Configurator.toFileList(configuration.getCompilerIncludeLibraries());
+        
+        return includeLibraries;
+    }
+
+    /**
+     * @return the runtimeSharedLibraries
+     */
+    @Override
+    public List<String> getRuntimeSharedLibraries()
+    {
+        return configuration.getRuntimeSharedLibraries();
+    }
+
+    /**
+     * @return the runtimeSharedLibraryPath
+     */
+    @Override
+    public List<RSLSettings> getRuntimeSharedLibraryPath()
+    {
+        if (rslLibraryPath == null)
+            rslLibraryPath = Configurator.getRSLSettingsFromConfiguration(configuration);
+        
+        return rslLibraryPath;
+    }
+
+    /**
+     * @return the includeClasses
+     */
+    @Override
+    public Collection<String> getIncludeClasses()
+    {
+        return configuration.getIncludeClasses();
+    }
+
+    /**
+     * @return the includeFiles
+     */
+    @Override
+    public Collection<File> getIncludeSources()
+    {
+        if (includeSources == null)
+        {
+            includeSources = new HashSet<File>();
+
+            List<File> files = Configurator.toFileList(configuration.getIncludeSources());
+            for (File file : files)
+            {
+                if (file.isFile())
+                {
+                    includeSources.add(file);
+                    continue;
+                }
+                else if (file.isDirectory())
+                {
+                    for (File fileInFolder : FileUtils.listFiles(file, new String[] {"as", "mxml"}, true))
+                        includeSources.add(fileInFolder);
+                }
+            }
+        }
+
+        return includeSources;
+    }
+
+    /**
+     * @return the includeFiles
+     */
+    @Override
+    public Map<String, File> getIncludeFiles()
+    {
+        if (includeFiles == null)
+        {
+            includeFiles = new TreeMap<String, File>();
+            for (Map.Entry<String, String> fileEntry : configuration.getIncludeFiles().entrySet())
+            {
+                includeFiles.put(fileEntry.getKey(), FilenameNormalization.normalize(new File(fileEntry.getValue())));
+            }
+        }
+
+        return includeFiles;
+    }
+
+    /**
+     * @return the includeNamespaces
+     */
+    @Override
+    public Collection<String> getIncludeNamespaces()
+    {
+        return configuration.getIncludeNamespaces();
+    }
+
+    /**
+     * @return the includeResourceBundles
+     */
+    @Override
+    public Collection<String> getIncludeResourceBundles()
+    {
+        return configuration.getIncludeResourceBundles();
+    }
+
+    /**
+     * @return the styleSheets
+     */
+    @Override
+    public Map<String, File> getIncludeStyleSheets()
+    {
+        // TODO: the configuration value needs to be fixed. It is only creating
+        // a list, not a map. targetSettings.setIncludeStyleSheets(configuration.getIncludeStyleSheets());
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean isLinkageExternal(String path)
+    {
+        if (externalLinkageLibraries == null)
+        {
+            initExternalLinkageLibraries();
+        }
+        
+        return externalLinkageLibraries.contains(path);
+    }
+
+    @Override
+    public boolean useDirectBlit()
+    {
+        // no config option for direct blit use, so default to false
+        return false;
+    }
+
+    @Override
+    public boolean useGPU()
+    {
+        //no config option for GPU use, so default to false
+        return false;
+    }
+
+    /**
+     * Merge external library path and RSL library path
+     */
+    private void initExternalLinkageLibraries()
+    {
+        externalLinkageLibraries = new HashSet<String>(getExternalLibraryPath().size() +
+                getRuntimeSharedLibraryPath().size());
+        
+        for (File library : getExternalLibraryPath())
+        {
+            externalLinkageLibraries.add(library.getAbsolutePath());
+        }
+
+        for (RSLSettings rsl : getRuntimeSharedLibraryPath())
+        {
+            externalLinkageLibraries.add(rsl.getLibraryFile().getAbsolutePath());
+        }
+    }
+
+    @Override
+    public List<String> getDefaultsCSSFiles()
+    {
+        return ImmutableList.copyOf(configuration.getDefaultsCSSFiles());
+    }
+
+    @Override
+    public File getLinkReport()
+    {
+        return configuration.getLinkReport();
+    }
+    
+    @Override
+    public File getSizeReport()
+    {
+        return configuration.getSizeReport();
+    }
+
+    @Override
+    public String getFlexMinimumSupportedVersion()
+    {
+        return configuration.getCompilerMinimumSupportedVersionString();
+    }
+
+    @Override
+    public boolean getMxmlChildrenAsData()
+    {
+        return configuration.getCompilerMxmlChildrenAsData();
+    }
+
+    @Override
+    public boolean getRemoveDeadCode()
+    {
+        return configuration.getRemoveDeadCode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/ArgumentNameGenerator.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/ArgumentNameGenerator.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/ArgumentNameGenerator.java
new file mode 100644
index 0000000..50c4a5a
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/ArgumentNameGenerator.java
@@ -0,0 +1,58 @@
+/*
+ *
+ *  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.internal.config.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation allows a programmatic interface for generating argument 
+ * names. Use this annotation when your argument names are more complex than
+ * allowed by @{@link Arguments}. 
+ * 
+ * <p>
+ * To use, provide a Class to the annotation. The Class must contain a method
+ * with the following signature:
+ * 
+ * <pre>
+ *    public static String getArgumentName(int argrumentNumber)
+ * </pre>
+ * 
+ * The getArgumentName method is a static function that takes a zero-based 
+ * argument number and returns the corresponding name of the argument. 
+ * 
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.METHOD)
+public @interface ArgumentNameGenerator
+{
+    /**
+     * 
+     * @return Class that contains a method
+     * with the following signature:
+     * 
+     * <pre>
+     *    public static String getArgumentName(int argrumentNumber)
+     * </pre>
+     */
+    Class<?> value();
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/Arguments.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/Arguments.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/Arguments.java
new file mode 100644
index 0000000..a8e8913
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/Arguments.java
@@ -0,0 +1,66 @@
+/*
+ *
+ *  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.internal.config.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Display names for the arguments of the annotated configuration option. This
+ * annotation also implies the number of expected arguments the annotated option
+ * expects. Use @{@link InfiniteArguments} to override the implication.
+ * <p>
+ * For example:
+ * 
+ * <pre>
+ * -default-script-limits [max-recursion-depth] [max-execution-time]
+ * </pre>
+ * 
+ * is defined as
+ * 
+ * <pre>
+ * &#64;Config()
+ * &#64;Arguments({"max-recursion-depth", "max-execution-time"})
+ * public void setDefaultScriptLimits(...);
+ * </pre>
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.METHOD)
+public @interface Arguments
+{
+    /**
+     * {@code path-element} is a commonly used argument name for options taking
+     * a file path.
+     */
+    public static final String PATH_ELEMENT = "path-element";
+
+    /**
+     * {@code path-element} is a commonly used argument name for options taking
+     * a file path.
+     */
+    public static final String CLASS = "class";
+
+    /**
+     * @return an array of argument names
+     */
+    String[] value() default "";
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/Config.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/Config.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/Config.java
new file mode 100644
index 0000000..b4510de
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/Config.java
@@ -0,0 +1,88 @@
+/*
+ *
+ *  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.internal.config.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Configuration annotation.
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.METHOD)
+public @interface Config
+{
+    /**
+     * @return True if this option is an advanced option.
+     */
+    boolean advanced() default false;
+
+    /**
+     * @return True if this option does not show in the help message.
+     */
+    boolean hidden() default false;
+
+    /**
+     * If {@code allowMultiple} is false, a variable can only be set once in a
+     * given file or command-line. Setting a variable that doesn't allow
+     * "multiple" twice will cause
+     * {@code ConfigurationException.IllegalMultipleSet}.
+     * <p>
+     * Set this to true if we want to accumulate values on the option. It's
+     * usually useful for collection-based options like
+     * {@code -compiler.external-library-path}.
+     * 
+     * @return True if the setter can be called multiple times
+     */
+    boolean allowMultiple() default false;
+
+    /**
+     * @return True if the values are treated as paths.
+     */
+    boolean isPath() default false;
+
+    /**
+     * @return True if the option is displayed.
+     */
+    boolean displayed() default true;
+    
+    /**
+     * @return True if the option is only visible to {@code compc}.
+     */
+    boolean compcOnly() default false;
+    
+    /**
+     * @return True indicates that the option is no longer 
+     * supported and will not have any affect.
+     */
+    boolean removed() default false;
+    
+    /**
+     * @return True if the commandline parser is in "greedy" mode.
+     */
+    boolean greedy() default false;
+    
+    /**
+     * @return true if the option must be set.
+     */
+    boolean isRequired() default false;
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/DefaultArgumentValue.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/DefaultArgumentValue.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/DefaultArgumentValue.java
new file mode 100644
index 0000000..0ff1d01
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/DefaultArgumentValue.java
@@ -0,0 +1,41 @@
+/*
+ *
+ *  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.internal.config.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * DefaultArgumentValue is used to specify default values for an argument,
+ * for when the value isn't specified.  This handles cases such as "--debug-password=",
+ * where we want to set a default value of "", rather than issuing an error saying
+ * the value count is wrong 
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.METHOD)
+public @interface DefaultArgumentValue
+{
+    /**
+     * @return an array of default argument values
+     */
+    String[] value() default "";
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/DeprecatedConfig.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/DeprecatedConfig.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/DeprecatedConfig.java
new file mode 100644
index 0000000..55fecd7
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/DeprecatedConfig.java
@@ -0,0 +1,38 @@
+/*
+ *
+ *  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.internal.config.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Deprecated configuration option.
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.METHOD)
+public @interface DeprecatedConfig
+{
+    /**
+     * @return Message about the deprecated message.
+     */
+    String value() default "deprecated option";
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/FlexOnly.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/FlexOnly.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/FlexOnly.java
new file mode 100644
index 0000000..d505e75
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/FlexOnly.java
@@ -0,0 +1,35 @@
+/*
+ *
+ *  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.internal.config.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *  Annotates a configuration option being Flex specific and not supported 
+ *  in AS-only applications.
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.METHOD)
+public @interface FlexOnly
+{
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/InfiniteArguments.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/InfiniteArguments.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/InfiniteArguments.java
new file mode 100644
index 0000000..9a0ec82
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/InfiniteArguments.java
@@ -0,0 +1,37 @@
+/*
+ *
+ *  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.internal.config.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Configuration options annotated with <code>@InfiniteArguments</code> has
+ * unlimited number of arguments, even if the option has a finite number of 
+ * argument names. 
+ * @see Arguments 
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface InfiniteArguments
+{
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/Mapping.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/Mapping.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/Mapping.java
new file mode 100644
index 0000000..ca55b57
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/Mapping.java
@@ -0,0 +1,47 @@
+/*
+ *
+ *  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.internal.config.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.flex.compiler.config.Configuration;
+
+/**
+ * This annotation explicitly specifies how a field in {@link Configuration}
+ * maps to a configuration option name. The value of the annotation is an array
+ * of strings. The strings are ordered elements of an option's canonical names.
+ * <p>
+ * For example:<br>
+ * <code>-compiler.namespaces.namespace</code> <br>
+ * maps to <br>
+ * <code>@Mapping({"compiler", "namespaces", "namespace"})</code>
+ * <p>
+ * This annotation is created to decouple the field name in
+ * {@link Configuration} and the real option name.
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.METHOD)
+public @interface Mapping
+{
+    String[] value() default {};
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/SoftPrerequisites.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/SoftPrerequisites.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/SoftPrerequisites.java
new file mode 100644
index 0000000..ca8c20a
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/annotations/SoftPrerequisites.java
@@ -0,0 +1,37 @@
+/*
+ *
+ *  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.internal.config.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+// TODO Verify if soft prerequisites are still needed.
+
+/**
+ * Prerequisites which should be set before this one if they exist.
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.METHOD)
+public @interface SoftPrerequisites
+{
+    String[] value() default {};
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/ILocalizedText.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/ILocalizedText.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/ILocalizedText.java
new file mode 100644
index 0000000..4150d50
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/ILocalizedText.java
@@ -0,0 +1,30 @@
+/*
+ *
+ *  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.internal.config.localization;
+
+import java.util.Map;
+
+/**
+ * Defines the API for formatting localized text.
+ */
+public interface ILocalizedText
+{
+    String format(Map<String, Object> parameters);
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/ILocalizer.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/ILocalizer.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/ILocalizer.java
new file mode 100644
index 0000000..259b0c2
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/ILocalizer.java
@@ -0,0 +1,30 @@
+/*
+ *
+ *  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.internal.config.localization;
+
+import java.util.Locale;
+
+/**
+ * Defines the API for looking up localized text.
+ */
+public interface ILocalizer
+{
+    ILocalizedText getLocalizedText( Locale locale, String id );
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/LocalizationManager.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/LocalizationManager.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/LocalizationManager.java
new file mode 100644
index 0000000..ec1250d
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/LocalizationManager.java
@@ -0,0 +1,234 @@
+/*
+ *
+ *  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.internal.config.localization;
+
+import java.util.*;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+
+/**
+ * A utility class for looking up localized text.
+ */
+public class LocalizationManager
+{
+    private Locale locale = Locale.getDefault();
+    private List<ILocalizer> localizers = new LinkedList<ILocalizer>();
+    
+    private static LocalizationManager instance = new LocalizationManager();
+    public static LocalizationManager get()
+    {
+        return instance;
+    }
+
+    private LocalizationManager()
+    {
+    }
+
+    public void addLocalizer( ILocalizer localizer )
+    {
+        localizers.add( localizer );
+    }
+
+    private ILocalizedText getLocalizedTextInner( Locale locale, String id )
+    {
+        for (Iterator<ILocalizer> it = localizers.iterator(); it.hasNext(); )
+        {
+            ILocalizer localizer = it.next();
+
+            ILocalizedText text = localizer.getLocalizedText( locale, id );
+
+            if (text != null)
+            {
+                return text;
+            }
+        }
+
+        return null;
+    }
+
+    private ILocalizedText getLocalizedText( Locale locale, String id )
+    {
+        ILocalizedText t = getLocalizedTextInner( locale, id );
+
+        if ((t == null) && (locale.getCountry().length() > 0) && (locale.getVariant().length() > 0))
+        {
+            t = getLocalizedTextInner( new Locale( locale.getLanguage(), locale.getCountry() ), id );
+        }
+
+        if ((t == null) && (locale.getCountry().length() > 0))
+        {
+            t = getLocalizedTextInner( new Locale( locale.getLanguage() ), id );
+        }
+
+        return t;
+    }
+
+    protected static String replaceInlineReferences( String text, Map<String, Object> parameters )
+    {
+        if (parameters == null)
+            return text;
+
+        int depth = 100;
+        while (depth-- > 0)
+        {
+            int o = text.indexOf( "${" );
+            if (o == -1)
+                break;
+            if ((o >= 1) && (text.charAt( o-1 ) == '$'))
+            {
+                o = text.indexOf( "${", o+2 );
+                if (o == -1)
+                    break;
+            }
+
+            int c = text.indexOf( "}", o );
+
+            if (c == -1)
+            {
+                return null;
+            }
+            String name = text.substring( o + 2, c );
+            String value = null;
+            if (parameters.containsKey( name ) && (parameters.get( name ) != null))
+            {
+                value = parameters.get( name ).toString();
+            }
+
+            if (value == null)
+            {
+                value = "";
+            }
+            text = text.substring( 0, o ) + value + text.substring( c + 1 );
+        }
+        return text.replaceAll( "[$][$][{]", "\\${" );
+    }
+
+	public String getLocalizedTextString( String id )
+	{
+		return getLocalizedTextString( id, Collections.<String, Object>emptyMap());
+	}
+
+	public String getLocalizedTextString( String id, Map<String, Object> parameters )
+	{
+		return getLocalizedTextString(locale, id, parameters );
+	}
+
+    public String getLocalizedTextString( Locale locale, String id, Map<String, Object> parameters )
+    {
+        ILocalizedText t = getLocalizedText( locale, id );
+
+        if ((t == null) && !locale.equals(locale))
+        {
+            t = getLocalizedText(locale, id );
+        }
+        if ((t == null) && !locale.getLanguage().equals( "en" ))
+        {
+            t = getLocalizedText( new Locale( "en" ), id );
+        }
+
+        return (t == null)? null : t.format( parameters );
+    }
+
+	public String getLocalizedTextString( Object object )
+	{
+		String s = getLocalizedTextString(locale, object );
+
+        return s;
+    }
+
+    // todo - this is a pretty specialized helper function, hoist up to client code?
+    public String getLocalizedTextString( Locale locale, Object object )
+    {
+        String id = object.getClass().getName().replaceAll( "\\$", "." );
+
+        Map<String, Object> parameters = new HashMap<String, Object>();
+        Class<?> c = object.getClass();
+
+        while (c != Object.class)
+        {
+            Field[] fields = c.getDeclaredFields();
+
+            for (int i = 0; i < fields.length; ++i)
+            {
+                Field f = fields[i];
+
+                if (!Modifier.isPublic( f.getModifiers() ))
+                {
+                    continue;
+                }
+                if (Modifier.isStatic( f.getModifiers() ))
+                {
+                    continue;
+                }
+
+                try
+                {
+                    parameters.put( f.getName(), f.get( object ) );
+                }
+                catch (Exception e)
+                {
+                }
+            }
+            c = c.getSuperclass();
+        }
+
+        String s = null;
+        if ((parameters.containsKey( "id" ) && parameters.get( "id" ) != null ))
+        {
+            String subid = parameters.get( "id" ).toString();
+            if (subid.length() > 0)
+            {
+                s = getLocalizedTextString( locale, id + "." + subid, parameters );
+            }
+        }
+        if (s == null)
+        {
+            s = getLocalizedTextString( locale, id, parameters );
+        }
+
+        if (s == null)
+        {
+            s = id;
+
+            if (parameters != null)
+            {
+                s += "[";
+                for (Iterator<Map.Entry<String, Object>> it = parameters.entrySet().iterator(); it.hasNext(); )
+                {
+                    Map.Entry<String, Object> e = it.next();
+                    s += e.getKey();
+                    if (e.getValue() != null)
+                        s += "='" + e.getValue() + "'";
+                    if (it.hasNext())
+                        s += ", ";
+                }
+                s += "]";
+            }
+            return s;
+        }
+
+        return s;
+    }
+
+    public void setLocale(Locale locale)
+    {
+        this.locale = locale;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/ResourceBundleLocalizer.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/ResourceBundleLocalizer.java b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/ResourceBundleLocalizer.java
new file mode 100644
index 0000000..d9fc3e9
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/ResourceBundleLocalizer.java
@@ -0,0 +1,77 @@
+/*
+ *
+ *  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.internal.config.localization;
+
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+
+import org.apache.flex.compiler.Messages;
+
+/**
+ * ILocalizer implementation, which supports looking up text in
+ * resource bundles.
+ */
+public class ResourceBundleLocalizer implements ILocalizer
+{
+    @Override
+    public ILocalizedText getLocalizedText( Locale locale, String id )
+    {
+        String prefix = id;
+
+        while (true)
+        {
+            int dot = prefix.lastIndexOf( '.' );
+            if (dot == -1)
+            {
+                break;
+            }
+            prefix = prefix.substring( 0, dot );
+            String suffix = id.substring( dot + 1 );
+            try
+            {
+                String message = Messages.getString(suffix);
+                if (message != null)
+                {
+                    return new ResourceBundleText(message);
+                }
+            }
+            catch (MissingResourceException e)
+            {
+            }
+        }
+
+        return null;
+    }
+
+    private class ResourceBundleText implements ILocalizedText
+    {
+        public ResourceBundleText( String text )
+        {
+            this.text = text;
+        }
+        @Override
+        public String format( Map<String, Object> parameters )
+        {
+            return LocalizationManager.replaceInlineReferences( text, parameters );
+        }
+        private String text;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/package.html
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/package.html b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/package.html
new file mode 100644
index 0000000..e283894
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/localization/package.html
@@ -0,0 +1,27 @@
+<!--
+
+  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.
+
+-->
+
+<html>
+<body>
+
+This package contains classes related to the legacy localization mechanism
+still used by the Flex configuration subsystem.
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/config/package.html
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/config/package.html b/compiler/src/main/java/org/apache/flex/compiler/internal/config/package.html
new file mode 100644
index 0000000..5c27831
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/config/package.html
@@ -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.
+
+-->
+
+<html>
+<body>
+
+This package is the internal counterpart of the external
+<code>org.apache.flex.compiler.config</code> package.
+
+<p>
+See the <a href="../../package-summary.html#package_description">description</a>
+of the <code>org.apache.flex.compiler</code> package for an explanation
+of how the compiler code is organized into external and internal packages.
+</p>
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSArrayPropertyValue.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSArrayPropertyValue.java b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSArrayPropertyValue.java
new file mode 100644
index 0000000..8fd93b0
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSArrayPropertyValue.java
@@ -0,0 +1,63 @@
+/*
+ *
+ *  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.internal.css;
+
+import java.util.List;
+
+import org.antlr.v4.runtime.TokenStream;
+import org.antlr.runtime.tree.CommonTree;
+
+import org.apache.flex.compiler.css.ICSSPropertyValue;
+import com.google.common.base.Joiner;
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Array type property values are comma-separated values in CSS properties.
+ * <p>
+ * For example:<br>
+ * <code>fillColors: #FFFFFF, #CCCCCC, #FFFFFF, #EEEEEE;</code>
+ */
+public class CSSArrayPropertyValue extends CSSPropertyValue
+{
+    public CSSArrayPropertyValue(final List<CSSPropertyValue> elements,
+                                 final CommonTree ast,
+                                 final TokenStream tokens)
+    {
+        super(ast, tokens, CSSModelTreeType.PROPERTY_VALUE);
+        this.elements = ImmutableList.copyOf(elements);
+        super.children.addAll(elements);
+    }
+
+    private final ImmutableList<CSSPropertyValue> elements;
+
+    /**
+     * @return Elements in the array property value.
+     */
+    public ImmutableList<? extends ICSSPropertyValue> getElements()
+    {
+        return elements;
+    }
+
+    @Override
+    public String toString()
+    {
+        return Joiner.on(", ").join(elements);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSColorPropertyValue.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSColorPropertyValue.java b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSColorPropertyValue.java
new file mode 100644
index 0000000..45de7f4
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSColorPropertyValue.java
@@ -0,0 +1,252 @@
+/*
+ *
+ *  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.internal.css;
+
+import org.antlr.runtime.Token;
+import org.antlr.v4.runtime.TokenStream;
+import org.antlr.runtime.tree.CommonTree;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Implementation for CSS color property values.
+ */
+public class CSSColorPropertyValue extends CSSPropertyValue
+{
+    /**
+     * Map color constant names to 24-bit RGB integer values.
+     * 
+     * @see <a href="http://www.w3schools.com/css/css_colorsfull.asp">SCC colors</a>
+     */
+    protected static final ImmutableMap<String, Integer> COLOR_MAP =
+            new ImmutableMap.Builder<String, Integer>()
+                    .put("black", 0x000000)
+                    .put("navy", 0x000080)
+                    .put("darkblue", 0x00008b)
+                    .put("mediumblue", 0x0000cd)
+                    .put("blue", 0x0000ff)
+                    .put("darkgreen", 0x006400)
+                    .put("green", 0x008000)
+                    .put("teal", 0x008080)
+                    .put("darkcyan", 0x008b8b)
+                    .put("deepskyblue", 0x00bfff)
+                    .put("darkturquoise", 0x00ced1)
+                    .put("mediumspringgreen", 0x00fa9a)
+                    .put("lime", 0x00ff00)
+                    .put("springgreen", 0x00ff7f)
+                    .put("aqua", 0x00ffff)
+                    .put("cyan", 0x00ffff)
+                    .put("midnightblue", 0x191970)
+                    .put("dodgerblue", 0x1e90ff)
+                    .put("lightseagreen", 0x20b2aa)
+                    .put("forestgreen", 0x228b22)
+                    .put("seagreen", 0x2e8b57)
+                    .put("darkslategray", 0x2f4f4f)
+                    .put("darkslategrey", 0x2f4f4f)
+                    .put("limegreen", 0x32cd32)
+                    .put("mediumseagreen", 0x3cb371)
+                    .put("turquoise", 0x40e0d0)
+                    .put("royalblue", 0x4169e1)
+                    .put("steelblue", 0x4682b4)
+                    .put("darkslateblue", 0x483d8b)
+                    .put("mediumturquoise", 0x48d1cc)
+                    .put("indigo ", 0x4b0082)
+                    .put("darkolivegreen", 0x556b2f)
+                    .put("cadetblue", 0x5f9ea0)
+                    .put("cornflowerblue", 0x6495ed)
+                    .put("mediumaquamarine", 0x66cdaa)
+                    .put("dimgray", 0x696969)
+                    .put("dimgrey", 0x696969)
+                    .put("slateblue", 0x6a5acd)
+                    .put("olivedrab", 0x6b8e23)
+                    .put("slategray", 0x708090)
+                    .put("slategrey", 0x708090)
+                    .put("lightslategray", 0x778899)
+                    .put("lightslategrey", 0x778899)
+                    .put("mediumslateblue", 0x7b68ee)
+                    .put("lawngreen", 0x7cfc00)
+                    .put("chartreuse", 0x7fff00)
+                    .put("aquamarine", 0x7fffd4)
+                    .put("maroon", 0x800000)
+                    .put("purple", 0x800080)
+                    .put("olive", 0x808000)
+                    .put("gray", 0x808080)
+                    .put("grey", 0x808080)
+                    .put("skyblue", 0x87ceeb)
+                    .put("lightskyblue", 0x87cefa)
+                    .put("blueviolet", 0x8a2be2)
+                    .put("darkred", 0x8b0000)
+                    .put("darkmagenta", 0x8b008b)
+                    .put("saddlebrown", 0x8b4513)
+                    .put("darkseagreen", 0x8fbc8f)
+                    .put("lightgreen", 0x90ee90)
+                    .put("mediumpurple", 0x9370d8)
+                    .put("darkviolet", 0x9400d3)
+                    .put("palegreen", 0x98fb98)
+                    .put("darkorchid", 0x9932cc)
+                    .put("yellowgreen", 0x9acd32)
+                    .put("sienna", 0xa0522d)
+                    .put("brown", 0xa52a2a)
+                    .put("darkgray", 0xa9a9a9)
+                    .put("darkgrey", 0xa9a9a9)
+                    .put("lightblue", 0xadd8e6)
+                    .put("greenyellow", 0xadff2f)
+                    .put("paleturquoise", 0xafeeee)
+                    .put("lightsteelblue", 0xb0c4de)
+                    .put("powderblue", 0xb0e0e6)
+                    .put("firebrick", 0xb22222)
+                    .put("darkgoldenrod", 0xb8860b)
+                    .put("mediumorchid", 0xba55d3)
+                    .put("rosybrown", 0xbc8f8f)
+                    .put("darkkhaki", 0xbdb76b)
+                    .put("silver", 0xc0c0c0)
+                    .put("mediumvioletred", 0xc71585)
+                    .put("indianred ", 0xcd5c5c)
+                    .put("peru", 0xcd853f)
+                    .put("chocolate", 0xd2691e)
+                    .put("tan", 0xd2b48c)
+                    .put("lightgray", 0xd3d3d3)
+                    .put("lightgrey", 0xd3d3d3)
+                    .put("palevioletred", 0xd87093)
+                    .put("thistle", 0xd8bfd8)
+                    .put("orchid", 0xda70d6)
+                    .put("goldenrod", 0xdaa520)
+                    .put("crimson", 0xdc143c)
+                    .put("gainsboro", 0xdcdcdc)
+                    .put("plum", 0xdda0dd)
+                    .put("burlywood", 0xdeb887)
+                    .put("lightcyan", 0xe0ffff)
+                    .put("lavender", 0xe6e6fa)
+                    .put("darksalmon", 0xe9967a)
+                    .put("violet", 0xee82ee)
+                    .put("palegoldenrod", 0xeee8aa)
+                    .put("lightcoral", 0xf08080)
+                    .put("khaki", 0xf0e68c)
+                    .put("aliceblue", 0xf0f8ff)
+                    .put("honeydew", 0xf0fff0)
+                    .put("azure", 0xf0ffff)
+                    .put("sandybrown", 0xf4a460)
+                    .put("wheat", 0xf5deb3)
+                    .put("beige", 0xf5f5dc)
+                    .put("whitesmoke", 0xf5f5f5)
+                    .put("mintcream", 0xf5fffa)
+                    .put("ghostwhite", 0xf8f8ff)
+                    .put("salmon", 0xfa8072)
+                    .put("antiquewhite", 0xfaebd7)
+                    .put("linen", 0xfaf0e6)
+                    .put("lightgoldenrodyellow", 0xfafad2)
+                    .put("oldlace", 0xfdf5e6)
+                    .put("red", 0xff0000)
+                    .put("fuchsia", 0xff00ff)
+                    .put("magenta", 0xff00ff)
+                    .put("deeppink", 0xff1493)
+                    .put("orangered", 0xff4500)
+                    .put("tomato", 0xff6347)
+                    .put("hotpink", 0xff69b4)
+                    .put("coral", 0xff7f50)
+                    .put("darkorange", 0xff8c00)
+                    .put("lightsalmon", 0xffa07a)
+                    .put("orange", 0xffa500)
+                    .put("lightpink", 0xffb6c1)
+                    .put("pink", 0xffc0cb)
+                    .put("gold", 0xffd700)
+                    .put("peachpuff", 0xffdab9)
+                    .put("navajowhite", 0xffdead)
+                    .put("moccasin", 0xffe4b5)
+                    .put("bisque", 0xffe4c4)
+                    .put("mistyrose", 0xffe4e1)
+                    .put("blanchedalmond", 0xffebcd)
+                    .put("papayawhip", 0xffefd5)
+                    .put("lavenderblush", 0xfff0f5)
+                    .put("seashell", 0xfff5ee)
+                    .put("cornsilk", 0xfff8dc)
+                    .put("lemonchiffon", 0xfffacd)
+                    .put("floralwhite", 0xfffaf0)
+                    .put("snow", 0xfffafa)
+                    .put("yellow", 0xffff00)
+                    .put("lightyellow", 0xffffe0)
+                    .put("ivory", 0xfffff0)
+                    .put("white", 0xffffff)
+                    .build();
+
+    /**
+     * Create a color property value from AST with hex color value such as
+     * {@code #FFEEDD}.
+     * 
+     * @param tree AST
+     * @param tokenStream token stream
+     */
+    protected CSSColorPropertyValue(final CommonTree tree,
+                                    final TokenStream tokenStream)
+    {
+        super(tree, tokenStream, CSSModelTreeType.PROPERTY_VALUE);
+        final String tokenText = tree.token.getText();
+        assert tokenText.startsWith("#") : "Invalid color:" + tokenText;
+
+        this.token = tree.token;
+        this.colorInt = Integer.parseInt(tokenText.substring(1), 16);
+    }
+
+    /**
+     * Create a color property value from color name keyword such as "red" ,
+     * "blue".
+     * 
+     * @param colorInt 24-bit RGB integer value
+     * @param tree AST
+     * @param tokenStream token stream
+     */
+    protected CSSColorPropertyValue(final int colorInt,
+                                    final CommonTree tree,
+                                    final TokenStream tokenStream)
+    {
+        super(tree, tokenStream, CSSModelTreeType.PROPERTY_VALUE);
+        this.token = tree.token;
+        this.colorInt = colorInt;
+    }
+
+    private final Token token;
+    private final int colorInt;
+
+    /**
+     * @return Integer value for the 24-bit color.
+     */
+    public int getColorAsInt()
+    {
+        return colorInt;
+    }
+
+    /**
+     * Get the original color property value text in the CSS document.
+     * <p>
+     * For example: {@code #FF0022}, {@code red}, {@code blue}.
+     * 
+     * @return Original color property value text in the CSS document.
+     */
+    public String getText()
+    {
+        return token.getText();
+    }
+
+    @Override
+    public String toString()
+    {
+        return token.getText();
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSCombinator.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSCombinator.java b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSCombinator.java
new file mode 100644
index 0000000..fe435f7
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSCombinator.java
@@ -0,0 +1,57 @@
+/*
+ *
+ *  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.internal.css;
+
+import org.antlr.v4.runtime.TokenStream;
+import org.antlr.runtime.tree.CommonTree;
+import org.apache.flex.compiler.css.CombinatorType;
+import org.apache.flex.compiler.css.ICSSCombinator;
+import org.apache.flex.compiler.css.ICSSSelector;
+
+/**
+ * Implementation of {@link ICSSCombinator}.
+ */
+public class CSSCombinator extends CSSNodeBase implements ICSSCombinator
+{
+    protected CSSCombinator(final CSSSelector selector, final CombinatorType type, 
+            final CommonTree tree, final TokenStream tokenStream)
+    {
+        super(tree, tokenStream, CSSModelTreeType.COMBINATOR);   
+        assert selector != null : "Selector can't be null.";
+        assert type != null : "Combinator type can't be null.";
+        this.selector = selector;
+        this.type = type;
+    }
+
+    private final CSSSelector selector;
+    private final CombinatorType type;
+
+    @Override
+    public ICSSSelector getSelector()
+    {
+        return selector;
+    }
+
+    @Override
+    public CombinatorType getCombinatorType()
+    {
+        return type;
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSDocument.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSDocument.java b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSDocument.java
new file mode 100644
index 0000000..ae75696
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSDocument.java
@@ -0,0 +1,180 @@
+/*
+ *
+ *  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.internal.css;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.antlr.v4.runtime.CharStream;
+import org.antlr.v4.runtime.CommonTokenStream;
+import org.antlr.v4.runtime.RecognitionException;
+import org.antlr.v4.runtime.TokenStream;
+import org.antlr.runtime.tree.CommonTree;
+import org.antlr.runtime.tree.CommonTreeNodeStream;
+
+import org.apache.flex.compiler.css.ICSSDocument;
+import org.apache.flex.compiler.css.ICSSFontFace;
+import org.apache.flex.compiler.css.ICSSNamespaceDefinition;
+import org.apache.flex.compiler.css.ICSSRule;
+import org.apache.flex.compiler.internal.css.CSSLexer;
+import org.apache.flex.compiler.internal.css.CSSParser;
+import org.apache.flex.compiler.internal.css.CSSTree;
+import org.apache.flex.compiler.problems.ICompilerProblem;
+import org.apache.flex.compiler.problems.UnexpectedExceptionProblem;
+import com.google.common.base.Joiner;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Implementation of a CSS model.
+ */
+public class CSSDocument extends CSSNodeBase implements ICSSDocument
+{
+    /** The short name for the default namespace is an empty string. */
+    private static final String DEFAULT_NAMESPACE_SHORT_NAME = "";
+
+    /**
+     * Parse a CSS document into {@link ICSSDocument} model.
+     * 
+     * @param input ANTLR input stream. The {@code CharStream#getSourceName()}
+     * must be implemented in order to make source location work.
+     * @param problems Parsing problems will be aggregated in this collection.
+     * @return CSS DOM object.
+     */
+    public static CSSDocument parse(final CharStream input, final Collection<ICompilerProblem> problems)
+    {
+        assert input != null : "CSS input can't be null";
+        assert problems != null : "Problem collection can't be null";
+
+        try
+        {
+            // parse and build tree
+            final CSSLexer lexer = new CSSLexer(input);
+            final CommonTokenStream tokens = new CommonTokenStream(lexer);
+            final CSSParser parser = new CSSParser(tokens);
+            final CSSParser.stylesheet_return stylesheet = parser.stylesheet();
+            final CommonTree ast = (CommonTree)stylesheet.getTree();
+            final CommonTreeNodeStream nodes = new CommonTreeNodeStream(ast);
+            nodes.setTokenStream(tokens);
+
+            // walk the tree and build definitions
+            final CSSTree treeWalker = new CSSTree(nodes);
+            treeWalker.stylesheet();
+
+            problems.addAll(lexer.problems);
+            problems.addAll(parser.problems);
+            problems.addAll(treeWalker.problems);
+
+            // definition models
+            return treeWalker.model;
+        }
+        catch (RecognitionException e)
+        {
+            assert false : "RecognitionException must be collected as ICompilerProblem.";
+            problems.add(new UnexpectedExceptionProblem(e));
+            return null;
+        }
+    }
+
+    /**
+     * Create a root CSS definition.
+     * 
+     * @param rules CSS rules
+     * @param namespaces {@code @namespace} statements
+     * @param fontFaces {@code @font-face} statements
+     * @param tree root of the AST
+     */
+    protected CSSDocument(final List<CSSRule> rules,
+                          final List<CSSNamespaceDefinition> namespaces,
+                          final List<CSSFontFace> fontFaces,
+                          final CommonTree tree,
+                          final TokenStream tokenStream)
+    {
+        super(tree, tokenStream, CSSModelTreeType.DOCUMENT);
+
+        assert rules != null : "Rules can't be null.";
+        assert namespaces != null : "Namespace definitions can't be null";
+        assert fontFaces != null : "Font face definitions can't be null";
+
+        this.rules = new ImmutableList.Builder<ICSSRule>().addAll(rules).build();
+        this.namespaces = new ImmutableList.Builder<ICSSNamespaceDefinition>().addAll(namespaces).build();
+        this.fontFaces = new ImmutableList.Builder<ICSSFontFace>().addAll(fontFaces).build();
+        
+        Map<String, CSSNamespaceDefinition> namespaceMap = new HashMap<String, CSSNamespaceDefinition>();
+        for (CSSNamespaceDefinition namespace : namespaces)
+        {
+            final String prefix = namespace.getPrefix();
+            final String key = prefix != null ? prefix : DEFAULT_NAMESPACE_SHORT_NAME;
+            namespaceMap.put(key, namespace);
+        }
+        this.namespacesLookup = ImmutableMap.copyOf(namespaceMap);
+
+        // setup tree
+        children.add(new CSSTypedNode(CSSModelTreeType.NAMESPACE_LIST, this.namespaces));
+        children.add(new CSSTypedNode(CSSModelTreeType.FONT_FACE_LIST, this.fontFaces));
+        children.add(new CSSTypedNode(CSSModelTreeType.RULE_LIST, this.rules));
+    }
+
+    private final ImmutableList<ICSSRule> rules;
+    private final ImmutableList<ICSSNamespaceDefinition> namespaces;
+    private final ImmutableList<ICSSFontFace> fontFaces;
+    private final ImmutableMap<String, CSSNamespaceDefinition> namespacesLookup;
+
+    @Override
+    public ImmutableList<ICSSRule> getRules()
+    {
+        return rules;
+    }
+
+    @Override
+    public ImmutableList<ICSSNamespaceDefinition> getAtNamespaces()
+    {
+        return namespaces;
+    }
+
+    @Override
+    public String toString()
+    {
+        return Joiner.on("\n").join(
+                Joiner.on("\n").join(namespaces),
+                Joiner.on("\n").join(fontFaces),
+                Joiner.on("\n").join(rules));
+    }
+
+    @Override
+    public ImmutableList<ICSSFontFace> getFontFaces()
+    {
+        return fontFaces;
+    }
+
+    @Override
+    public ICSSNamespaceDefinition getNamespaceDefinition(String prefix)
+    {
+        return namespacesLookup.get(prefix);
+    }
+
+    @Override
+    public ICSSNamespaceDefinition getDefaultNamespaceDefinition()
+    {
+        return namespacesLookup.get(DEFAULT_NAMESPACE_SHORT_NAME);
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSFontFace.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSFontFace.java b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSFontFace.java
new file mode 100644
index 0000000..774c018
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSFontFace.java
@@ -0,0 +1,182 @@
+/*
+ *
+ *  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.internal.css;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+
+import org.antlr.v4.runtime.TokenStream;
+import org.antlr.runtime.tree.CommonTree;
+
+import org.apache.flex.compiler.css.FontFaceSourceType;
+import org.apache.flex.compiler.css.ICSSFontFace;
+import org.apache.flex.compiler.css.ICSSProperty;
+import org.apache.flex.compiler.css.ICSSPropertyValue;
+
+/**
+ * Implementation for {@code @font-face} statement DOM.
+ */
+public class CSSFontFace extends CSSNodeBase implements ICSSFontFace
+{
+
+    /**
+     * Construct a {@code CSSFontFace} from a list of properties. The parser
+     * doesn't validate if the properties are acceptable by the
+     * {@code @font-face} statement, so that we don't need to update the grammar
+     * when new properties are added to {@code @font-face} statement.
+     * 
+     * @param properties key value pairs inside the {@code @font-face} block.
+     */
+    protected CSSFontFace(final List<CSSProperty> properties,
+                          final CommonTree tree,
+                          final TokenStream tokenStream)
+    {
+        super(tree, tokenStream, CSSModelTreeType.FONT_FACE);
+
+        assert properties != null : "Properties can't be null for @font-face.";
+
+        ICSSPropertyValue srcValue = null;
+        ICSSPropertyValue fontFamilyValue = null;
+        ICSSPropertyValue fontStyleValue = null;
+        ICSSPropertyValue fontWeightValue = null;
+        ICSSPropertyValue embedAsCFFValue = null;
+        ICSSPropertyValue advancedAAValue = null;
+
+        for (final ICSSProperty property : properties)
+        {
+            final String name = property.getName();
+            final ICSSPropertyValue value = property.getValue();
+            if (name.equals("src"))
+            {
+                srcValue = value;
+            }
+            else if (name.equals("fontFamily"))
+            {
+                fontFamilyValue = value;
+            }
+            else if (name.equals("fontStyle"))
+            {
+                fontStyleValue = value;
+            }
+            else if (name.equals("fontWeight"))
+            {
+                fontWeightValue = value;
+            }
+            else if (name.equals("embedAsCFF"))
+            {
+                embedAsCFFValue = value;
+            }
+            else if (name.equals("advancedAntiAliasing"))
+            {
+                advancedAAValue = value;
+            }
+            else
+            {
+                // Ignore unknown properties.
+            }
+        }
+
+        checkNotNull(srcValue, "'src' is required in @font-face");
+        source = (CSSFunctionCallPropertyValue)srcValue;
+
+        checkNotNull(fontFamilyValue, "'fontFamily' is required in @font-face");
+        fontFamily = fontFamilyValue.toString();
+
+        fontStyle = fontStyleValue == null ? "normal" : fontStyleValue.toString();
+        fontWeight = fontWeightValue == null ? "normal" : fontWeightValue.toString();
+        isEmbedAsCFF = embedAsCFFValue == null ?
+                true : embedAsCFFValue.toString().equalsIgnoreCase("true");
+        isAdvancedAntiAliasing = advancedAAValue == null ?
+                true : advancedAAValue.toString().equalsIgnoreCase("true");
+        
+    }
+
+    private final CSSFunctionCallPropertyValue source;
+    private final String fontFamily;
+    private final String fontStyle;
+    private final String fontWeight;
+    private final boolean isEmbedAsCFF;
+    private final boolean isAdvancedAntiAliasing;
+
+    @Override
+    public FontFaceSourceType getSourceType()
+    {
+        return Enum.valueOf(FontFaceSourceType.class, source.name.toUpperCase());
+    }
+
+    @Override
+    public String getSourceValue()
+    {
+        String sourceValue = null;
+        if(FontFaceSourceType.URL.equals(getSourceType()) 
+                || FontFaceSourceType.LOCAL.equals(getSourceType()))
+            sourceValue = CSSFunctionCallPropertyValue.getSingleArgumentFromRaw(source.rawArguments);
+        return sourceValue;
+    }
+
+    @Override
+    public String getFontFamily()
+    {
+        return fontFamily;
+    }
+
+    @Override
+    public String getFontStyle()
+    {
+        return fontStyle;
+    }
+
+    @Override
+    public String getFontWeight()
+    {
+        return fontWeight;
+    }
+    
+    public boolean getEmbedAsCFF()
+    {
+        return isEmbedAsCFF;
+    }
+
+    @Override
+    public boolean getAdvancedAntiAliasing()
+    {
+        return isAdvancedAntiAliasing;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder result = new StringBuilder();
+        result.append("@font-face {\n");
+        result.append("    src : ")
+                .append(source)
+                .append(";\n");
+        result.append("    fontFamily : ").append(fontFamily).append(";\n");
+        result.append("    embedAsCFF : ").append(isEmbedAsCFF);
+        result.append("    advancedAntiAliasing : ")
+                .append(isAdvancedAntiAliasing)
+                .append(";\n");
+        result.append("    fontStyle : ").append(fontStyle).append(";\n");
+        result.append("    fontWeight : ").append(fontWeight).append(";\n");
+        result.append("}\n");
+        return result.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/59f6373b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSFunctionCallPropertyValue.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSFunctionCallPropertyValue.java b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSFunctionCallPropertyValue.java
new file mode 100644
index 0000000..917f6ac
--- /dev/null
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSFunctionCallPropertyValue.java
@@ -0,0 +1,96 @@
+/*
+ *
+ *  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.internal.css;
+
+import org.antlr.v4.runtime.TokenStream;
+import org.antlr.runtime.tree.CommonTree;
+
+import org.apache.flex.compiler.css.ICSSDocument;
+
+/**
+ * Base class for CSS function call property values.
+ * <p>
+ * For example: {@code Embed("bg.png")}.
+ */
+public class CSSFunctionCallPropertyValue extends CSSPropertyValue
+{
+    /** Function name for {@code ClassReference("")}. */
+    public static final String CLASS_REFERENCE = "ClassReference";
+    /** Function name for {@code PropetyReference("")}. */
+    public static final String PROPERTY_REFERENCE = "PropertyReference";
+    /** Function name for {@code Embed("")}. */
+    public static final String EMBED = "Embed";
+
+    /** Name of the function. */
+    public final String name;
+
+    /** Raw arguments text excluding the parentheses. */
+    public final String rawArguments;
+
+    /**
+     * Initialize a {@link CSSFunctionCallPropertyValue}.
+     * 
+     * @param name Function name.
+     * @param rawArguments Raw argument string with parentheses and quotes.
+     * @param tree AST.
+     * @param tokenStream Token stream.
+     */
+    public CSSFunctionCallPropertyValue(final String name,
+                                        final String rawArguments,
+                                        final CommonTree tree,
+                                        final TokenStream tokenStream)
+    {
+        super(tree, tokenStream, CSSModelTreeType.PROPERTY_VALUE);
+        this.name = name;
+        this.rawArguments = rawArguments.substring(1, rawArguments.length() - 1);
+    }
+
+    /**
+     * Generate CSS code fragment for this model object. This is used by
+     * recursively generating a CSS document from a {@link ICSSDocument} for
+     * debugging and testing purposes.
+     */
+    @Override
+    public String toString()
+    {
+        return String.format("%s(%s)", name, rawArguments);
+    }
+
+    /**
+     * If {@code rawArguments} is of pattern {@code "argument"} 
+     * or {@code 'argument'}, then return {@code argument}. Otherwise, 
+     * return the original value.
+     * 
+     * @param rawArguments Raw argument from {@link #rawArguments}.
+     * @return Single argument name.
+     */
+    public static String getSingleArgumentFromRaw(final String rawArguments)
+    {
+        if ( (rawArguments.startsWith("\"") && rawArguments.endsWith("\""))
+                || (rawArguments.startsWith("'") && rawArguments.endsWith("'")) )
+        {
+            return rawArguments.substring(1, rawArguments.length() - 1);
+        }
+        else
+        {
+            return rawArguments;
+        }
+    }
+}


Mime
View raw message