예제 #1
0
 def run(self, m: Match, file_reader: FileReader) -> bool:
     if file_reader.status not in [
             'lemma_lean', 'theorem_lean', 'example_lean', 'definition_lean'
     ]:
         return False
     file_reader.status = 'proof'
     file_reader.normal_line_handler = dismiss_line  # Proofs shouldn't start with normal line
     return True
예제 #2
0
    def run(self, m: Match, file_reader: FileReader) -> bool:
        if file_reader.status != 'definition_text':
            return False
        file_reader.status = 'definition_lean'
        theorem = file_reader.objects[-1]

        def normal_line(file_reader: FileReader, line: str) -> None:
            theorem.lean_append(line)

        file_reader.normal_line_handler = normal_line
        return True
예제 #3
0
    def run(self, m: Match, file_reader: FileReader) -> bool:
        if file_reader.status != 'example_text':
            return False
        file_reader.status = 'example_lean'
        example = file_reader.objects[-1]

        def normal_line(file_reader: FileReader, line: str) -> None:
            example.lean_append(line)

        file_reader.normal_line_handler = normal_line
        return True
예제 #4
0
    def run(self, m: Match, file_reader: FileReader) -> bool:
        if file_reader.status:
            return False
        file_reader.status = 'definition_text'
        defn = Definition(sideBar=False)
        file_reader.objects.append(defn)

        def normal_line(file_reader: FileReader, line: str) -> None:
            defn.text_append(line)

        file_reader.normal_line_handler = normal_line
        return True
예제 #5
0
    def run(self, m: Match, file_reader: FileReader) -> bool:
        if file_reader.status:
            return False
        file_reader.status = 'hidden'
        lean_lines = LeanLines(hidden=True)
        file_reader.objects.append(lean_lines)

        def normal_line(file_reader: FileReader, line: str) -> None:
            lean_lines.append(line)

        file_reader.normal_line_handler = normal_line
        return True
예제 #6
0
    def run(self, m: Match, file_reader: FileReader) -> bool:
        if file_reader.status:
            return False
        file_reader.status = 'example_text'
        example = Example()
        example.sideBar = not (m.group(1).strip() == 'no-side-bar')
        file_reader.objects.append(example)

        def normal_line(file_reader: FileReader, line: str) -> None:
            example.text_append(line)

        file_reader.normal_line_handler = normal_line
        return True
예제 #7
0
    def run(self, m: Match, file_reader: FileReader) -> bool:
        if file_reader.status:
            return False
        file_reader.status = 'theorem_text'
        theorem = Theorem()
        theorem.sideBar = not (m.group(1).strip() == 'no-side-bar')
        file_reader.objects.append(theorem)

        def normal_line(file_reader: FileReader, line: str) -> None:
            theorem.text_append(line)

        file_reader.normal_line_handler = normal_line
        return True
예제 #8
0
    def run(self, m: Match, file_reader: FileReader) -> bool:
        if file_reader.status:
            return False
        file_reader.status = 'lemma_text'
        lemma = Lemma()
        lemma.sideBar = (m.group(1).strip() != 'no-side-bar')
        file_reader.objects.append(lemma)

        def normal_line(file_reader: FileReader, line: str) -> None:
            lemma.text_append(line)

        file_reader.normal_line_handler = normal_line
        return True
예제 #9
0
    def run(self, m: Match, file_reader: FileReader) -> bool:
        if file_reader.status:
            return False
        file_reader.status = 'hint'
        hint = Hint(title=m.group(1).strip())
        file_reader.objects.append(hint)

        def normal_line(file_reader: FileReader, line: str) -> None:
            hint.append(line)

        file_reader.normal_line_handler = normal_line
        file_reader.blank_line_handler = normal_line
        return True
예제 #10
0
    def run(self, m: Match, file_reader: FileReader) -> bool:
        if file_reader.status:
            return False
        file_reader.status = 'text'
        text = Text()
        file_reader.objects.append(text)

        def normal_line(file_reader: FileReader, line: str) -> None:
            text.append(line)

        file_reader.normal_line_handler = normal_line
        file_reader.blank_line_handler = normal_line
        return True
예제 #11
0
    def run(self, m: Match, file_reader: FileReader) -> bool:
        if file_reader.status:
            return False
        file_reader.status = 'axiom'
        axiom = Axiom(sideBar=True)
        axiom.name = m.group(1).strip()
        file_reader.objects.append(axiom)

        def normal_line(file_reader: FileReader, line: str) -> None:
            axiom.append(line)

        file_reader.normal_line_handler = normal_line
        file_reader.blank_line_handler = normal_line
        return True
예제 #12
0
    def run(self, m: Match, file_reader: FileReader) -> bool:
        if file_reader.status:
            return False
        file_reader.status = 'tactic'
        tactic = Tactic(sideBar=True)
        tactic.name = m.group(1).strip()
        file_reader.objects.append(tactic)

        def normal_line(file_reader: FileReader, line: str) -> None:
            tactic.append(line)

        file_reader.normal_line_handler = normal_line
        file_reader.blank_line_handler = normal_line
        return True
예제 #13
0
 def run(self, m: Match, file_reader: FileReader) -> bool:
     if file_reader.status != 'proof_hint':
         return False
     file_reader.status = 'proof'
     return True
예제 #14
0
 def run(self, m: Match, file_reader: FileReader) -> bool:
     if file_reader.status != 'proof':
         return False
     file_reader.status = 'proof_hint'
     file_reader.normal_line_handler = dismiss_line  # Proofs shouldn't start with normal line
     return True