byteface / sharpshooter

A shorthand for creating files and folders. (A parser could be written in any language)
MIT License
11 stars 1 forks source link

- rememeber original settings #26

Closed github-actions[bot] closed 2 years ago

github-actions[bot] commented 2 years ago

This issue was automatically created by a github action that converts project Todos to issues.

https://github.com/byteface/sharpshooter/blob/9dad050bc0b3b61ae562b0533c6dc7ef2008c44d/sharpshooter/__init__.py#L366

    # ignore spaces before comments
    # t_ignore_SPACESCOMMENTFIX = r'[ ]+' + r'\#.*' # note - not working ?

    def t_label(self, t):
        r"\#\["
        self.empty_line = False

        content = t.lexer.lexdata[t.lexer.lexpos:]
        if content.find("\n") != -1:
            content = content[:content.find("\n")]
        original_length = len(content)
        content = '\n'.join(content.split('\\n'))
        if content[0] == " ":
            content = content[1:]
        # split at the first space
        content = content.split(" ", 1)[0]
        # if last is a ']' then remove it
        if content[-1] == "]":
            content = content[:-1]

        self.current_label = content
        t.lexer.skip(original_length)

    def t_newline(self, t):
        r"\n+"
        # print("THE CURRENT LABEL IS:", self.current_label, t.lexer.lineno)

        if tree.LABEL is not None:
            # print('get me:', self.current_label, tree.LABEL, (self.current_label != tree.LABEL))
            if self.current_label != tree.LABEL:
                tree.TEST_MODE = True
                tree.QUIET_MODE = True
            else:
                tree.TEST_MODE = False #tree._TEST_MODE_BAK
                tree.QUIET_MODE = False # tree._QUIET_MODE_BAK
            # TODO - rememeber original settings

        t.lexer.lineno += t.value.count("\n")
        self.was_dir = self.is_dir
        self.is_dir = False
byteface commented 2 years ago

i think this is literally uncommenting those stashed vars. however not been through testing due to not yet passing it as a CLI param. I had tested some lables by setting the new const in the class however. that should probably be a list... so this was stalled unto those things are wired out. a single label will be fine for now accepted via cli into all commands same way quiet was done.

github-actions[bot] commented 2 years ago

Closed in b7afabf36077e1d982f523b71e742597441dedff