Examples of TwigModuleDeclaration


Examples of com.dubture.twig.core.parser.ast.node.TwigModuleDeclaration

                        try {

                            SymfonyTemplateResolver resolver = new SymfonyTemplateResolver();
                            SourceModule sourceModule = resolver.revolePath(parent, scriptProject);
                            TwigModuleDeclaration twig = (TwigModuleDeclaration) SourceParserUtil.parseSourceModule(sourceModule);

                            blocks = new LinkedList<String>();
                            if (twig != null) {
                                for (BlockStatement block : twig.getBlocks()) {

                                    if (block.isBlock()) {
                                        blocks.add(block.getBlockName().getValue());
                                    }
                                }
View Full Code Here

Examples of com.dubture.twig.core.parser.ast.node.TwigModuleDeclaration

    public void apply(ICompletionReporter reporter) throws Exception
    {
       
        BlocknameContext context = (BlocknameContext) getContext();
       
        TwigModuleDeclaration module = context.getModule();
        BlockStatement extendsBlock = module.getExtends();
       
        if (extendsBlock == null) {
            return;
        }
       
        StringLiteral literal = (StringLiteral) extendsBlock.getFirstChild();
       
        if (literal == null) {
            return;
        }
       
        String path = literal.getValue();
        List<ITemplateResolver> providers = ExtensionManager.getInstance().getTemplateProviders();
       
        String prefix = context.getPrefix();
        SourceRange range = getReplacementRange(context);
       
        for (ITemplateResolver resolver : providers) {
           
            SourceModule sourceModule = resolver.revolePath(path, context.getSourceModule().getScriptProject());
            TwigModuleDeclaration parent = (TwigModuleDeclaration) SourceParserUtil.parseSourceModule(sourceModule);
           
            if (parent != null) {
                for (BlockStatement block : parent.getBlocks()) {
                    BlockName name = block.getName();
                    if (name != null && "block".equals(name.getValue())) {
                        Variable child = (Variable) block.getFirstChild();
                        String value = child.getValue();
                       
View Full Code Here

Examples of com.dubture.twig.core.parser.ast.node.TwigModuleDeclaration

    @Override
    public IModuleDeclaration parse(IModuleSource input, IProblemReporter reporter)
    {
        try {
           
            TwigModuleDeclaration module = (TwigModuleDeclaration) SourceParserUtil.parseSourceModule(input.getSourceContents());
           
            if (module != null) {
                module.traverse(new SourceParserVisitor(reporter));
            }           

            return module;

        } catch (Exception e) {
View Full Code Here

Examples of com.dubture.twig.core.parser.ast.node.TwigModuleDeclaration

    public IModuleDeclaration parse(Reader in, IProblemReporter reporter,
            boolean useShortTags) throws Exception
    {
        try {
           
            TwigModuleDeclaration module = (TwigModuleDeclaration) SourceParserUtil.parseSourceModule(in);
           
            if (module != null) {
                module.traverse(new SourceParserVisitor(reporter));
            }           

            return module;

        } catch (Exception e) {
View Full Code Here

Examples of com.dubture.twig.core.parser.ast.node.TwigModuleDeclaration

          case 1: // $START ::= module EOF
            {
              Object RESULT = null;
    int start_valleft = ((java_cup.runtime.Symbol)CUP$TwigAstParser$stack.elementAt(CUP$TwigAstParser$top-1)).left;
    int start_valright = ((java_cup.runtime.Symbol)CUP$TwigAstParser$stack.elementAt(CUP$TwigAstParser$top-1)).right;
    TwigModuleDeclaration start_val = (TwigModuleDeclaration)((java_cup.runtime.Symbol) CUP$TwigAstParser$stack.elementAt(CUP$TwigAstParser$top-1)).value;
    RESULT = start_val;
              CUP$TwigAstParser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$TwigAstParser$stack.elementAt(CUP$TwigAstParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$TwigAstParser$stack.elementAt(CUP$TwigAstParser$top-0)).right, RESULT);
            }
          /* ACCEPT */
          CUP$TwigAstParser$parser.done_parsing();
          return CUP$TwigAstParser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 0: // module ::= top_statement_list
            {
              TwigModuleDeclaration RESULT = null;
    int sListleft = ((java_cup.runtime.Symbol)CUP$TwigAstParser$stack.elementAt(CUP$TwigAstParser$top-0)).left;
    int sListright = ((java_cup.runtime.Symbol)CUP$TwigAstParser$stack.elementAt(CUP$TwigAstParser$top-0)).right;
    List sList = (List)((java_cup.runtime.Symbol) CUP$TwigAstParser$stack.elementAt(CUP$TwigAstParser$top-0)).value;
                    
                        TwigModuleDeclaration module = parser.getModuleDeclaration();
                        module.setStatements(sList);
                        module.setStart(sListleft);
                        module.setEnd(sListright);
                        RESULT = module;
                    
              CUP$TwigAstParser$result = new java_cup.runtime.Symbol(1/*module*/, ((java_cup.runtime.Symbol)CUP$TwigAstParser$stack.elementAt(CUP$TwigAstParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$TwigAstParser$stack.elementAt(CUP$TwigAstParser$top-0)).right, RESULT);
            }
          return CUP$TwigAstParser$result;
View Full Code Here

Examples of com.dubture.twig.core.parser.ast.node.TwigModuleDeclaration

       
    }
   
    public TwigModuleDeclaration getParent(TwigModuleDeclaration child, IScriptProject project)
    {
        TwigModuleDeclaration parent = null;
        String path = getParentPath(child, project);
       
        for (ITemplateResolver resolver : ExtensionManager.getInstance().getTemplateProviders()) {
           
            SourceModule module = resolver.revolePath(path, project);
View Full Code Here

Examples of com.dubture.twig.core.parser.ast.node.TwigModuleDeclaration

        ISourceModule source = (ISourceModule) sourceUnit.getModelElement();
        final IScriptProject project = source.getScriptProject();
       
        try {
           
            final TwigModuleDeclaration module = (TwigModuleDeclaration) SourceParserUtil.parseSourceModule((SourceModule)source);
            final List<IModelElement> elements = new ArrayList<IModelElement>();
           
            if (module == null) {
                return null;
            }
           
            module.traverse(new TwigASTVisitor()
            {
                @Override
                public boolean visit(TwigCallExpression s) throws Exception
                {
                    if (s.sourceStart() <= offset && s.sourceEnd() >= offset) {
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.