Search in sources :

Example 1 with Lexer

use of com.sun.tools.javac.parser.Lexer in project lombok by rzwitserloot.

the class CommentCollectingParserFactory method newParser.

public Parser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap) {
    ScannerFactory scannerFactory = ScannerFactory.instance(context);
    Lexer lexer = scannerFactory.newScanner(input, true);
    Object x = new CommentCollectingParser(this, lexer, true, keepLineMap);
    return (Parser) x;
// CCP is based on a stub which extends nothing, but at runtime the stub is replaced with either
//javac6's EndPosParser which extends Parser, or javac7's EndPosParser which implements Parser.
//Either way this will work out.
}
Also used : Lexer(com.sun.tools.javac.parser.Lexer) ScannerFactory(com.sun.tools.javac.parser.ScannerFactory) Parser(com.sun.tools.javac.parser.Parser)

Example 2 with Lexer

use of com.sun.tools.javac.parser.Lexer in project lombok by rzwitserloot.

the class CommentCollectingParserFactory method newParser.

public JavacParser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap) {
    ScannerFactory scannerFactory = ScannerFactory.instance(context);
    Lexer lexer = scannerFactory.newScanner(input, true);
    Object x = new CommentCollectingParser(this, lexer, true, keepLineMap, keepEndPos);
    return (JavacParser) x;
// CCP is based on a stub which extends nothing, but at runtime the stub is replaced with either
//javac6's EndPosParser which extends Parser, or javac8's JavacParser which implements Parser.
//Either way this will work out.
}
Also used : Lexer(com.sun.tools.javac.parser.Lexer) JavacParser(com.sun.tools.javac.parser.JavacParser) ScannerFactory(com.sun.tools.javac.parser.ScannerFactory)

Aggregations

Lexer (com.sun.tools.javac.parser.Lexer)2 ScannerFactory (com.sun.tools.javac.parser.ScannerFactory)2 JavacParser (com.sun.tools.javac.parser.JavacParser)1 Parser (com.sun.tools.javac.parser.Parser)1