Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FunctionDef source extract using getText() #3216

Closed
Yuxin45 opened this issue Jul 5, 2021 · 1 comment
Closed

FunctionDef source extract using getText() #3216

Yuxin45 opened this issue Jul 5, 2021 · 1 comment

Comments

@Yuxin45
Copy link

Yuxin45 commented Jul 5, 2021

Hi, I am trying to extract all function definitions within a source . I implemented a Listener and implemented fuction enterFuncdef(Python3Parser.FuncdefContext ctx). However, with using ctx.getText() to extract the source block for the function definition, I found out that within the result, all space are skipped after keywords (eg. return abc becomes 'returnabc', for i in list becomes 'foriinlist', ...) but I want to keep the original space within function definition since I need the source code. Is there anything I can do to address this issue?
Thanks a lot!

@Yuxin45 Yuxin45 changed the title FunctionDef Extract using getText() FunctionDef source extract using getText() Jul 5, 2021
@ericvergnaud
Copy link
Contributor

Hi, please move this to the google discussion group

@parrt parrt added this to the 4.9.3 milestone Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants