Package org.jrubyparser.lexer

Examples of org.jrubyparser.lexer.Lexer


        }
        return null;
    }

    private Properties collectDocNodes(File file) throws IOException {
        Lexer lexer = new Lexer();
        lexer.setSource(LexerSource.getSource(file.getName(), new FileReader(file), new ParserConfiguration()));
        lexer.setPreserveSpaces(true);
        lexer.setWarnings(new Parser.NullWarnings());
        String doc;
        int token = -1;
        Properties props = new Properties();
        while (lexer.advance()) {
            if (token == -1)
                token = lexer.token();
            if (token == Tokens.tDOCUMENTATION) {
                doc = "=" + lexer.getTokenBuffer().toString();
                while (lexer.advance() && (token = lexer.token()) == Tokens.tWHITESPACE) {
                }
                if (token != Tokens.kDEF)
                    continue;
                while (lexer.advance() && (token = lexer.token()) == Tokens.tWHITESPACE) {
                }
                if (token != Tokens.tIDENTIFIER)
                    continue;
                props.setProperty(lexer.getTokenBuffer().toString(), doc);
            }
            token = -1;
        }
        return props;
    }
View Full Code Here

TOP

Related Classes of org.jrubyparser.lexer.Lexer

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.