# All files / parser python3.ts

100% Statements 12/12
100% Branches 0/0
100% Functions 2/2
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    214x
    4x
    4x
    4x
    4x

    4x

    4x

    10x
    10x
    10x

    9x
    9x

     import { InputStream, CommonTokenStream, Lexer } from 'antlr4';
    import { Python3Lexer } from '../lib/python3/Python3Lexer';
    import { Python3Parser } from '../lib/python3/Python3Parser';
    export * from '../lib/python3/Python3Listener';
    export * from '../lib/python3/Python3Visitor';

    import BasicParser from './common/BasicParser';

    export default class Python extends BasicParser {
        public createLexer(input: string): Lexer {
            const chars = new InputStream(input);
            const lexer = (<unknown>new Python3Lexer(chars)) as Lexer;
            return lexer;
        }

        public createParserFromLexer(lexer: Lexer) {
            const tokens = new CommonTokenStream(lexer);
            return new Python3Parser(tokens);
        }
    }