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

code_manager.py file #32

Closed
kylebarron opened this issue Aug 7, 2018 · 2 comments · Fixed by #44
Closed

code_manager.py file #32

kylebarron opened this issue Aug 7, 2018 · 2 comments · Fixed by #44

Comments

@kylebarron
Copy link
Owner

This file should have a class that accepts an unmodified input string and returns a list of run-able code blocks. In general each item of the list should be a single line of Stata code, except when that line of Stata code would not return to a dot prompt.

class CodeManager(object):
    def __init__(self, code):
        self.input = code
        self.tokens = self.tokenize_code()

    def tokenize_code(self):
        # Do tokenizing with Pygments
        # Return a list of tokens

    def is_complete(self):
        # Analyze tokens
        # Determine if all of input is complete.
        # Return simple True/False

    def completions(self, cursor_pos):
        # Unclear whether it's necessary to tokenize the code for this.
        # Return dict with correct Jupyter message

    def tokens_to_lines():
        # Form logical code chunks from tokens
        # This should also remove comments
        # Returns a list of code chunks that are safe to run in the console
@kylebarron
Copy link
Owner Author

Keep in mind a way to retrieve locals / return despite running cap log close

@kylebarron
Copy link
Owner Author

Probably ideal to try to get a local/return value through Automation before closing the log.

This was referenced Aug 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant