Package org.apache.flex.compiler.common

Examples of org.apache.flex.compiler.common.MutablePrefixMap


     *
     * @return a prefix map
     */
    public PrefixMap getDocumentPrefixMap()
    {
        MutablePrefixMap map = new MutablePrefixMap();
        for (PrefixMap tagMap : nsMap.values())
        {
            assert tagMap != null;
            map.addAll(tagMap);
        }
        return map.toImmutable();
    }
View Full Code Here


                }
               
                case MXMLTokenTypes.TOKEN_OPEN_TAG_START:
                {
                    unit = new MXMLTagData();
                    MutablePrefixMap map = ((MXMLTagData)unit).init(this, token, tokenIterator, dialect, spec, problems);
                    ((MXMLTagData)unit).setCommentToken(currentComment);
                    currentComment = null;
                    units.add(unit);
                    index++;
                    if (fullContent)
                    {
                        unit.setParentUnitDataIndex(depth.peek());
                        unit.setLocation(data, index);
                        if (!((MXMLTagData)unit).isEmptyTag())
                            processor.addOpenTag((MXMLTagData)unit, balancingIndex);
                    }
                    if (map != null)
                        nsMap.put((MXMLTagData)unit, map.toImmutable());
                    if (!((MXMLTagData)unit).isEmptyTag())
                    {
                        depth.push(index);
                        balancingIndex++;
                    }
View Full Code Here

    @SuppressWarnings("fallthrough")
    MutablePrefixMap init(IMXMLData mxmlData, MXMLToken nameToken, ListIterator<MXMLToken> tokenIterator, MXMLDialect dialect, IFileSpecification spec, Collection<ICompilerProblem> problems)
    {
        setSourcePath(mxmlData.getPath());
        MutablePrefixMap map = null;
        emptyTag = false;
        explicitCloseToken = false;

        // the start offset will by where '<' is. We strip that text off, but need to remember correct offset first
        int startOffset = nameToken.getStart();
        if (nameToken.getType() == MXMLTokenTypes.TOKEN_OPEN_TAG_START)
            nameToken.truncate(1, 0);
        else if (nameToken.getType() == MXMLTokenTypes.TOKEN_CLOSE_TAG_START)
            nameToken.truncate(2, 0);
        else
        {
            problems.add(new SyntaxProblem(nameToken));
            return map;
        }

        // Deal with name if it is of the form name.state
        int nameStart = nameToken.getStart();
        MXMLStateSplitter splitState = new MXMLStateSplitter(nameToken, dialect, problems, spec);
        tagName = splitState.getBaseName();
        if (splitState.getStateName() != null)
        {
            stateName = splitState.getStateName();
            stateStart = nameToken.getStart() + splitState.getStateNameOffset();
        }

        nameType = nameToken.getType();

        int nameEnd = nameStart + tagName.length();
        int contentEnd = nameEnd;
        setTagOffsets(startOffset, nameEnd, nameStart, contentEnd);
        setColumn(nameToken.getColumn());
        setLine(nameToken.getLine());
        attributesStart = getNameEnd();
        ArrayList<IMXMLTagAttributeData> attrs = new ArrayList<IMXMLTagAttributeData>();
        attributeMap = new LinkedHashMap<String, IMXMLTagAttributeData>(); //preserve order of attrs
        boolean foundTagEnd = false;
        boolean putTokenBack = false; // This is a pre-falcon algorithm that helped recover from tag nesting errors
                                      // I am bringing it back to life
        while (tokenIterator.hasNext() && !foundTagEnd)
        {
            MXMLToken token = tokenIterator.next();
            MXMLTagAttributeData attribute = null;
            switch (token.getType())
            {
                case MXMLTokenTypes.TOKEN_NAME:
                    if (nameType == MXMLTokenTypes.TOKEN_CLOSE_TAG_START)
                    {
                        problems.add(new SyntaxProblem(token));
                        //burn forward until the end tag
                        //TODO do we want to mark each token as an error, or just the first?
                        while (tokenIterator.hasNext() && !foundTagEnd)
                        {
                            token = tokenIterator.next();
                            switch (token.getType())
                            {
                                case MXMLTokenTypes.TOKEN_TAG_END:
                                case MXMLTokenTypes.TOKEN_EMPTY_TAG_END:
                                    foundTagEnd = true;
                                    break;
                            }
                        }
                        break;
                    }
                    if (token.getText().startsWith("xmlns"))
                    {
                        attribute = new MXMLNamespaceAttributeData(token, tokenIterator, dialect, spec, problems);
                        if (map == null)
                            map = new MutablePrefixMap();
                        map.add(((IMXMLNamespaceAttributeData)attribute).getNamespacePrefix(), ((IMXMLNamespaceAttributeData)attribute).getNamespace());
                    }
                    else
                    {
                        attribute = new MXMLTagAttributeData(token, tokenIterator, dialect, spec, problems);
                    }
View Full Code Here

    }

    @Override
    public PrefixMap getCompositePrefixMap()
    {
        MutablePrefixMap compMap = new MutablePrefixMap();
        IMXMLTagData lookingAt = this;
        while (lookingAt != null)
        {
            PrefixMap depth = getParent().getPrefixMapForData(lookingAt);
            if (depth != null)
            {
                compMap.addAll(depth, true);
            }
            lookingAt = lookingAt.getParentTag();
        }
        return compMap;
    }
View Full Code Here

   */
  public MXMLTokenizer(String path)
  {
      tokenizer = new RawMXMLTokenizer();
        problems = new ArrayList<ICompilerProblem>();
        rootPrefixMap = new MutablePrefixMap();
        this.path = path;
  }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.common.MutablePrefixMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.