Title: How do you walk the AST with the use of `ctx`? · Issue #2 · lexanth/python-ast · GitHub
Open Graph Title: How do you walk the AST with the use of `ctx`? · Issue #2 · lexanth/python-ast
X Title: How do you walk the AST with the use of `ctx`? · Issue #2 · lexanth/python-ast
Description: 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...
Open Graph Description: 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 = createVisi...
X Description: 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...
Opengraph URL: https://github.com/lexanth/python-ast/issues/2
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"How do you walk the AST with the use of `ctx`?","articleBody":"I think that in order to use this library, I need to do something like:\r\n\r\n```\r\nimport { walk, parse, createVisitor } from 'python-ast';\r\n\r\nlet ast = parse(`\r\nprint(\"hello world!)\r\n`);\r\n\r\nlet listener = createVisitor(ast);\r\n\r\nwalk(ast, listener);\r\n```\r\n\r\nbut I got this error:\r\n\r\n```\r\nno viable alternative at input '!'\r\nctx.enterRule(listener);\r\n ^\r\nTypeError: Cannot read property 'enterRule' of undefined\r\n```\r\nThis 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.","author":{"url":"https://github.com/genderev","@type":"Person","name":"genderev"},"datePublished":"2021-11-29T21:46:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/2/python-ast/issues/2"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a1cf70a4-009e-5b9e-bf35-ab3a9d49ebfe |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D28C:ACE92:FBA1D:149CFA:699209E0 |
| html-safe-nonce | 5e74c540b079e6dcf407a88f534f80ac6b612750976eae5c115d4ae2dbc177fb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjhDOkFDRTkyOkZCQTFEOjE0OUNGQTo2OTkyMDlFMCIsInZpc2l0b3JfaWQiOiI4NjAwOTg0OTM5MDMzMzk3NzI4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 329b2c0c13b6f00bd3c20c430b767d93f5aeb2085be63d8abded1dde55d405e3 |
| hovercard-subject-tag | issue:1066536424 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/lexanth/python-ast/2/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6f4ec39aed3576ce0f6eab109e578abe64e5ebfe28c889cfc4e12ed36453075d/lexanth/python-ast/issues/2 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6f4ec39aed3576ce0f6eab109e578abe64e5ebfe28c889cfc4e12ed36453075d/lexanth/python-ast/issues/2 |
| og:image:alt | 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 = createVisi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | genderev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/lexanth/python-ast git https://github.com/lexanth/python-ast.git |
| octolytics-dimension-user_id | 1242475 |
| octolytics-dimension-user_login | lexanth |
| octolytics-dimension-repository_id | 285685333 |
| octolytics-dimension-repository_nwo | lexanth/python-ast |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 285685333 |
| octolytics-dimension-repository_network_root_nwo | lexanth/python-ast |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width