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

Fix coq analyze text logic #1597

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pygments/lexers/theorem.py
Expand Up @@ -154,7 +154,7 @@ class CoqLexer(RegexLexer):
}

def analyse_text(text):
if 'qed' in text and 'tauto' in text:
if re.search(r'[qQ]ed', text) and 'tauto' in text:
return 1


Expand Down
18 changes: 18 additions & 0 deletions tests/test_theorem.py
@@ -0,0 +1,18 @@
import pytest

from pygments.lexers.theorem import CoqLexer

@pytest.fixture(scope="module")
def lexer():
yield CoqLexer()

def test_coq_analyze_text(lexer):
text = r"""
Theorem demorgan : forall (P Q : Prop),
~(P \/ Q) -> ~P /\ ~Q.
Proof.
tauto.
Qed.
"""
res = lexer.analyse_text(text)
assert res == 1.0