Package org.apache.flex.compiler.internal.parsing.as

Examples of org.apache.flex.compiler.internal.parsing.as.OffsetLookup


    public int getNameEnd()
    {
        if (absoluteNameEnd == UNKNOWN)
            return UNKNOWN;

        OffsetLookup offsetLookup = getOffsetLookup();
        if (offsetLookup == null)
            return absoluteNameEnd;

        return offsetLookup.getLocalOffset(absoluteNameEnd);
    }
View Full Code Here


        setSourcePath(attribute.getParent().getParent().getFileSpecification().getPath());

        final int startOffsetLocal = attribute.getValueStart();
        final ASFileScope fileScope = builder.getFileScope();
        final OffsetLookup offsetLookup = fileScope.getOffsetLookup();
        assert offsetLookup != null : "Expected OffsetLookup on FileScope.";
        final String filePath = getContainingFilePath();
        final int[] absoluteOffsets =
                offsetLookup.getAbsoluteOffset(filePath, startOffsetLocal);
        final int startOffsetAbsolute = absoluteOffsets[0];
        final IncludeHandler includeHandler =
                IncludeHandler.createForASTBuilding(builder.getFileSpecificationGetter(), filePath, startOffsetLocal, startOffsetAbsolute);
        includeHandler.setProjectAndCompilationUnit(project, builder.getCompilationUnit());
        final String scriptFragment = attribute.getRawValue();
View Full Code Here

        ISourceFragment[] fragments = attribute.getValueFragments(problems);

        // Adjust fragment offsets from local to absolute,
        // to take into account include files, source attributes, etc.
        final MXMLFileScope fileScope = builder.getFileScope();
        final OffsetLookup offsetLookup = fileScope.getOffsetLookup();
        assert offsetLookup != null : "Expected OffsetLookup on FileScope.";
        for (ISourceFragment fragment : fragments)
        {
            int physicalStart = fragment.getPhysicalStart();
            final int[] absoluteOffsets = offsetLookup.getAbsoluteOffset(attribute.getSourcePath(), physicalStart);
            ((SourceFragment)fragment).setPhysicalStart(absoluteOffsets[0]);
        }

        // Parse the fragments inside the databinding expression.
        Reader reader = new SourceFragmentsReader(attribute.getSourcePath(), fragments);
View Full Code Here

     * Get the node's local start offset.
     */
    @Override
    public int getStart()
    {
        final OffsetLookup offsetLookup = tryGetOffsetLookup();
        if (offsetLookup != null)
        {
            // to handle start offset in an included file
            int absoluteOffset = getAbsoluteStart();
            final String pathBeforeCaret = offsetLookup.getFilename(absoluteOffset - 1);
            // if the offset is the first offset in the included file return without adjustment
            if (pathBeforeCaret != null && pathBeforeCaret.equals(getSourcePath()))
                return offsetLookup.getLocalOffset(absoluteOffset-1)+1;
           
            return offsetLookup.getLocalOffset(absoluteOffset);
        }
       
        return super.getStart();
    }
View Full Code Here

     * Get the node's local end offset.
     */
    @Override
    public int getEnd()
    {
        final OffsetLookup offsetLookup = tryGetOffsetLookup();
        return offsetLookup != null ?
                // to handle end offset in an included file
                offsetLookup.getLocalOffset(super.getEnd() - 1) + 1 :
                super.getEnd();
    }
View Full Code Here

    //
   
    @Override
    public int getOperatorStart()
    {
        final OffsetLookup offsetLookup = tryGetOffsetLookup();
        return offsetLookup != null ?
               offsetLookup.getLocalOffset(operatorStart) :
               operatorStart;
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.internal.parsing.as.OffsetLookup

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.