Examples of CeylonParser


Examples of com.redhat.ceylon.compiler.typechecker.parser.CeylonParser

        if (file.getName().endsWith(".ceylon")) {

            //System.out.println("Parsing " + file.getName());
            CeylonLexer lexer = new CeylonLexer(new ANTLRInputStream(file.getInputStream(), getEncoding()));
            CommonTokenStream tokenStream = new CommonTokenStream(lexer);
            CeylonParser parser = new CeylonParser(tokenStream);
            Tree.CompilationUnit cu = parser.compilationUnit();
            List<CommonToken> tokens = new ArrayList<CommonToken>(tokenStream.getTokens().size());
            tokens.addAll(tokenStream.getTokens());
            PhasedUnit phasedUnit = new PhasedUnit(file, srcDir, cu,
                    moduleManager.getCurrentPackage(), moduleManager,
                    context, tokens);
            addPhasedUnit(file, phasedUnit);

            List<LexError> lexerErrors = lexer.getErrors();
            for (LexError le : lexerErrors) {
                //System.out.println("Lexer error in " + file.getName() + ": " + le.getMessage());
                cu.addLexError(le);
            }
            lexerErrors.clear();

            List<ParseError> parserErrors = parser.getErrors();
            for (ParseError pe : parserErrors) {
                //System.out.println("Parser error in " + file.getName() + ": " + pe.getMessage());
                cu.addParseError(pe);
            }
            parserErrors.clear();
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.parser.CeylonParser

        ANTLRStringStream input = new ANTLRStringStream(source);
        CeylonLexer lexer = new CeylonLexer(input);

        CommonTokenStream tokens = new CommonTokenStream(lexer);

        CeylonParser parser = new CeylonParser(tokens);
//        CompilationUnit cu = parser.compilationUnit();
//        System.err.println(cu.hashCode());
    }
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.parser.CeylonParser

    private boolean updateModuleVersion(Module module, Map<String,String> updatedModuleVersions) throws IOException,
            RecognitionException {
        String moduleDescriptorPath = module.getUnit().getFullPath();
        CeylonLexer lexer = new CeylonLexer(new ANTLRFileStream(moduleDescriptorPath, encoding));
        TokenRewriteStream tokenStream = new TokenRewriteStream(lexer);
        CeylonParser parser = new CeylonParser(tokenStream);
        Tree.CompilationUnit cu = parser.compilationUnit();
        String v = this.confirm == Confirm.dependencies ? this.newVersion : confirm("update.module.version", module.getNameAsString(), module.getVersion(), this.newVersion);
        if (v == null) {
            return false;
        } else if (!v.isEmpty()) {
            // record the new version for this module
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.parser.CeylonParser

    private boolean updateModuleImports(Module module, Map<String,String> updatedModuleVersions) throws IOException,
            RecognitionException {
        String moduleDescriptorPath = module.getUnit().getFullPath();
        CeylonLexer lexer = new CeylonLexer(new ANTLRFileStream(moduleDescriptorPath, encoding));
        TokenRewriteStream tokenStream = new TokenRewriteStream(lexer);
        CeylonParser parser = new CeylonParser(tokenStream);
        Tree.CompilationUnit cu = parser.compilationUnit();
        List<Tree.ImportModule> moduleImports = findUpdatedImport(cu, updatedModuleVersions);
        for (Tree.ImportModule moduleImport : moduleImports) {
            String importedModuleName = getModuleName(moduleImport);
            String newVersion = updatedModuleVersions.get(importedModuleName);
            if(newVersion == null)
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.parser.CeylonParser

            outputVersion(module);
        } else if (dependencies) {
            String moduleDescriptorPath = module.getUnit().getFullPath();
            CeylonLexer lexer = new CeylonLexer(new ANTLRFileStream(moduleDescriptorPath, encoding));
            CommonTokenStream tokenStream = new CommonTokenStream(lexer);
            CeylonParser parser = new CeylonParser(tokenStream);
            Tree.CompilationUnit cu = parser.compilationUnit();
            List<Tree.ImportModule> moduleImports = findImport(cu);
            for (Tree.ImportModule moduleImport : moduleImports) {
                outputDependency(module, moduleImport);
            }
        }
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.parser.CeylonParser

                ANTLRStringStream input = new NewlineFixingStringStream(source);
                CeylonLexer lexer = new CeylonLexer(input);

                CommonTokenStream tokens = new CommonTokenStream(lexer);

                CeylonParser parser = new CeylonParser(tokens);
                CompilationUnit cu = parser.compilationUnit();

                java.util.List<LexError> lexerErrors = lexer.getErrors();
                for (LexError le : lexerErrors) {
                    printError(le, le.getMessage(), "ceylon.lexer", map);
                }

                java.util.List<ParseError> parserErrors = parser.getErrors();
                for (ParseError pe : parserErrors) {
                    printError(pe, pe.getMessage(), "ceylon.parser", map);
                }

                // if we continue and it's not a descriptor, we don't care about errors
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.