Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Unicode support for Coq Catch-all lexing for `Name.Builtin.Pseudo`, as in the lean lexer. This fixes #678. * Coq lexer: improve `analyse_text` * Add a test for Coq
- Loading branch information
Maximilian Wuttke
committed
Jan 4, 2021
1 parent
039ba3f
commit c01ccfe
Showing
2 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Coq Tests | ||
~~~~~~~~~~~~~ | ||
:copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. | ||
:license: BSD, see LICENSE for details. | ||
""" | ||
|
||
import pytest | ||
|
||
from pygments.lexers import CoqLexer | ||
from pygments.token import Token | ||
|
||
@pytest.fixture(scope='module') | ||
def lexer(): | ||
yield CoqLexer() | ||
|
||
def test_coq_unicode(lexer): | ||
fragment = 'Check (α ≻ β).\n' | ||
tokens = [ | ||
(Token.Keyword.Namespace, 'Check'), | ||
(Token.Text, ' '), | ||
(Token.Operator, '('), | ||
(Token.Name, 'α'), | ||
(Token.Text, ' '), | ||
(Token.Name.Builtin.Pseudo, '≻'), | ||
(Token.Text, ' '), | ||
(Token.Name, 'β'), | ||
(Token.Operator, ')'), | ||
(Token.Operator, '.'), | ||
(Token.Text, '\n'), | ||
] | ||
assert list(lexer.get_tokens(fragment)) == tokens |