Skip to content

How do you walk the AST with the use of ctx? #2

@genderev

Description

@genderev

I think that in order to use this library, I need to do something like:

import { walk, parse, createVisitor } from 'python-ast';

let ast = parse(`
print("hello world!)
`);

let listener = createVisitor(ast);

walk(ast, listener);

but I got this error:

no viable alternative at input '!'
ctx.enterRule(listener);
            ^
TypeError: Cannot read property 'enterRule' of undefined

This library is quite opaque to me. I've been unable to use antlr4 directly (by installing antlr4 using npm). I'm not sure why I'm getting this error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions