Examples of TwigParserResult


Examples of org.netbeans.modules.php.twig.editor.parsing.TwigParserResult

public class TwigStructureScanner implements StructureScanner {

    @Override
    public List<? extends StructureItem> scan( ParserResult info ) {
        TwigParserResult result = (TwigParserResult)info;
        List<TwigParserResult.Block> blocks = new ArrayList<TwigParserResult.Block>();
        List<TwigStructureItem> items = new ArrayList<TwigStructureItem>();
       
        for ( TwigParserResult.Block item : result.getBlocks() ) {
            if ( CharSequenceUtilities.equals( item.getDescription(), "block" ) || CharSequenceUtilities.equals( item.getDescription(), "*inline-block" ) ) {
                blocks.add( item );
            }
        }
       
        boolean isTopLevel = false;
       
        for ( TwigParserResult.Block item : blocks ) {
           
            isTopLevel = true;
           
            for ( TwigParserResult.Block check : blocks ) {
               
                if ( item.getOffset() > check.getOffset() &&
                     item.getOffset() + item.getLength() < check.getOffset() + check.getLength()
                ) {
                    isTopLevel = false;
                    break;
                }
               
            }
           
            if ( isTopLevel ) {
                items.add( new TwigStructureItem( result.getSnapshot(), item, blocks ) );
            }
           
        }

        return items;
View Full Code Here

Examples of org.netbeans.modules.php.twig.editor.parsing.TwigParserResult

    }

    @Override
    public Map<String, List<OffsetRange>> folds( ParserResult info ) {
       
        TwigParserResult result = (TwigParserResult)info;
        List<OffsetRange> ranges = new ArrayList<OffsetRange>();
       
        for ( TwigParserResult.Block block : result.getBlocks() ) {

            ranges.add( new OffsetRange(
                    block.getOffset(), block.getOffset() + block.getLength()
            ) );
           
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.