Examples of JFlexPsiFile


Examples of org.intellij.lang.jflex.psi.JFlexPsiFile

            if (!settings.ENABLED_EMBED_JAVA) return;

            JFlexJavaCode host = (JFlexJavaCode) _host;

            assert host.getContainingFile() instanceof JFlexPsiFile;
            JFlexPsiFile file = (JFlexPsiFile) host.getContainingFile();

            JFlexJavaCode importSection = file.getImports();
            //processing imports and package section
            if (importSection == host) {
                registrar.addPlace(StdLanguages.JAVA, new TextRange(0, host.getTextLength()), null, "\npublic class a{}");
                return;
            }

            StringBuilder prefix = new StringBuilder();

            //let's add some imports and package statements from flex file header
            if (importSection != null) {
                prefix.append(importSection.getText());
            }

            String classnamestr = DEFCLASS;
            JFlexElement classname = file.getClassname();
            if (classname != null) {
                classnamestr = classname.getText();
            }

            String returntypestr = DEFTYPE;
            JFlexElement returntype = file.getReturnType();
            if (returntype != null) {
                returntypestr = returntype.getText();
            }

            StringBuilder implementedstr = new StringBuilder();
            JFlexElement[] implemented = file.getImplementedInterfaces();
            //what a lousy piece of code.
            if (implemented.length > 0) {
                implementedstr.append(" implements ");
                for (int i = 0; i < implemented.length; i++) {
                    JFlexElement jFlexElement = implemented[i];
View Full Code Here

Examples of org.intellij.lang.jflex.psi.JFlexPsiFile

            this.module = module;
            this.testSource = testSource;
            String generationName = null;
            PsiFile psiFile = PsiManager.getInstance(module.getProject()).findFile(file);
            if (psiFile instanceof JFlexPsiFile) {
                JFlexPsiFile flexPsiFile = (JFlexPsiFile) psiFile;
                ASTNode node = flexPsiFile.getNode();
                if (node != null) {
                    /* lazy-lazy parser won't actually parse a file it has not been opened in editor before.
                     * let's persuade it pretending that we really need all the stuff in a file.*/
                    node.getPsi().getChildren();
                    JFlexElement generateName = flexPsiFile.getClassname();
                    if (generateName != null) {
                        generationName = generateName.getText();
                    }
                }
            }
View Full Code Here

Examples of org.intellij.lang.jflex.psi.JFlexPsiFile

    }

    @Nullable
    public PsiElement resolve() {
        //todo: do the right way
        JFlexPsiFile file = (JFlexPsiFile) this.getContainingFile();
        JFlexStateStatement[] macroses = file.getStateStatements();
        List<JFlexStateDefinition> suspects = new ArrayList<JFlexStateDefinition>();
        for (JFlexStateStatement macros : macroses) {
            suspects.addAll(Arrays.asList(macros.getStateDefinitions()));
        }
        for (JFlexStateDefinition suspect : suspects) {
View Full Code Here

Examples of org.intellij.lang.jflex.psi.JFlexPsiFile

    }

    @Nullable
    public PsiElement resolve() {
        //Is it the correct way?
        JFlexPsiFile file = (JFlexPsiFile) this.getContainingFile();
        JFlexMacroDefinition[] macroses = file.getDeclaredMacroses();
        for (JFlexMacroDefinition m : macroses) {
            if (getText().equals(m.getName())) {
                return m;
            }
        }
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.