Skip to content

Commit

Permalink
Merge pull request #2588 from jeanas/urls
Browse files Browse the repository at this point in the history
Add URLs to lexers and require the `url` attribute
  • Loading branch information
Anteru committed Nov 19, 2023
2 parents eb16763 + 9ce0597 commit 446b45c
Show file tree
Hide file tree
Showing 99 changed files with 346 additions and 66 deletions.
2 changes: 1 addition & 1 deletion pygments/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class Lexer(metaclass=LexerMeta):
priority = 0

#: URL of the language specification/definition. Used in the Pygments
#: documentation.
#: documentation. Set to an empty string to disable.
url = None

#: Example file name. Relative to the ``tests/examplefiles`` directory.
Expand Down
2 changes: 2 additions & 0 deletions pygments/lexers/actionscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ActionScriptLexer(RegexLexer):
filenames = ['*.as']
mimetypes = ['application/x-actionscript', 'text/x-actionscript',
'text/actionscript']
url = 'https://en.wikipedia.org/wiki/ActionScript'

flags = re.DOTALL
tokens = {
Expand Down Expand Up @@ -213,6 +214,7 @@ class MxmlLexer(RegexLexer):
aliases = ['mxml']
filenames = ['*.mxml']
mimetimes = ['text/xml', 'application/xml']
url = 'https://en.wikipedia.org/wiki/MXML'

tokens = {
'root': [
Expand Down
1 change: 1 addition & 0 deletions pygments/lexers/ada.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class AdaLexer(RegexLexer):
aliases = ['ada', 'ada95', 'ada2005']
filenames = ['*.adb', '*.ads', '*.ada']
mimetypes = ['text/x-ada']
url = 'https://www.adaic.org'

flags = re.MULTILINE | re.IGNORECASE

Expand Down
1 change: 1 addition & 0 deletions pygments/lexers/algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class GAPConsoleLexer(Lexer):
name = 'GAP session'
aliases = ['gap-console', 'gap-repl']
filenames = ['*.tst']
url = 'https://www.gap-system.org'

def get_tokens_unprocessed(self, text):
gaplexer = GAPLexer(**self.options)
Expand Down
1 change: 1 addition & 0 deletions pygments/lexers/amdgpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class AMDGPULexer(RegexLexer):
name = 'AMDGPU'
aliases = ['amdgpu']
filenames = ['*.isa']
url = 'https://gpuopen.com/amd-isa-documentation'

flags = re.IGNORECASE

Expand Down
2 changes: 2 additions & 0 deletions pygments/lexers/apdlexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class apdlexer(RegexLexer):
name = 'ANSYS parametric design language'
aliases = ['ansys', 'apdl']
filenames = ['*.ans']
url = 'https://www.ansys.com'

flags = re.IGNORECASE

# list of elements
Expand Down
9 changes: 4 additions & 5 deletions pygments/lexers/archetype.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
pygments.lexers.archetype
~~~~~~~~~~~~~~~~~~~~~~~~~
Lexer for Archetype-related syntaxes, including:
- ODIN syntax <https://github.com/openEHR/odin>
- ADL syntax <http://www.openehr.org/releases/trunk/architecture/am/adl2.pdf>
- cADL sub-syntax of ADL
Lexer for Archetype-related syntaxes, including ODIN, ADL and cADL.
For uses of this syntax, see the openEHR archetypes <http://www.openEHR.org/ckm>
Expand Down Expand Up @@ -146,6 +142,7 @@ class OdinLexer(AtomsLexer):
aliases = ['odin']
filenames = ['*.odin']
mimetypes = ['text/odin']
url = 'https://github.com/openEHR/odin'

tokens = {
'path': [
Expand Down Expand Up @@ -194,6 +191,7 @@ class CadlLexer(AtomsLexer):
name = 'cADL'
aliases = ['cadl']
filenames = ['*.cadl']
url = 'https://specifications.openehr.org/releases/AM/latest/ADL2.html#_cadl_constraint_adl'

tokens = {
'path': [
Expand Down Expand Up @@ -260,6 +258,7 @@ class AdlLexer(AtomsLexer):
name = 'ADL'
aliases = ['adl']
filenames = ['*.adl', '*.adls', '*.adlf', '*.adlx']
url = 'https://specifications.openehr.org/releases/AM/latest/ADL2.html'

tokens = {
'whitespace': [
Expand Down
1 change: 1 addition & 0 deletions pygments/lexers/asc.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class AscLexer(RegexLexer):
]
mimetypes = ['application/pgp-keys', 'application/pgp-encrypted',
'application/pgp-signature', 'application/pem-certificate-chain']
url = 'https://www.openpgp.org'

flags = re.MULTILINE

Expand Down
11 changes: 11 additions & 0 deletions pygments/lexers/asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class GasLexer(RegexLexer):
aliases = ['gas', 'asm']
filenames = ['*.s', '*.S']
mimetypes = ['text/x-gas']
url = 'https://www.gnu.org/software/binutils'

#: optional Comment or Whitespace
string = r'"(\\"|[^"])*"'
Expand Down Expand Up @@ -167,6 +168,7 @@ class ObjdumpLexer(RegexLexer):
aliases = ['objdump']
filenames = ['*.objdump']
mimetypes = ['text/x-objdump']
url = 'https://www.gnu.org/software/binutils'

tokens = _objdump_lexer_tokens(GasLexer)

Expand All @@ -179,6 +181,7 @@ class DObjdumpLexer(DelegatingLexer):
aliases = ['d-objdump']
filenames = ['*.d-objdump']
mimetypes = ['text/x-d-objdump']
url = 'https://www.gnu.org/software/binutils'

def __init__(self, **options):
super().__init__(DLexer, ObjdumpLexer, **options)
Expand All @@ -192,6 +195,7 @@ class CppObjdumpLexer(DelegatingLexer):
aliases = ['cpp-objdump', 'c++-objdumb', 'cxx-objdump']
filenames = ['*.cpp-objdump', '*.c++-objdump', '*.cxx-objdump']
mimetypes = ['text/x-cpp-objdump']
url = 'https://www.gnu.org/software/binutils'

def __init__(self, **options):
super().__init__(CppLexer, ObjdumpLexer, **options)
Expand All @@ -205,6 +209,8 @@ class CObjdumpLexer(DelegatingLexer):
aliases = ['c-objdump']
filenames = ['*.c-objdump']
mimetypes = ['text/x-c-objdump']
url = 'https://www.gnu.org/software/binutils'


def __init__(self, **options):
super().__init__(CLexer, ObjdumpLexer, **options)
Expand All @@ -220,6 +226,7 @@ class HsailLexer(RegexLexer):
aliases = ['hsail', 'hsa']
filenames = ['*.hsail']
mimetypes = ['text/x-hsail']
url = 'https://en.wikipedia.org/wiki/Heterogeneous_System_Architecture#HSA_Intermediate_Layer'

string = r'"[^"]*?"'
identifier = r'[a-zA-Z_][\w.]*'
Expand Down Expand Up @@ -715,6 +722,7 @@ class NasmLexer(RegexLexer):
aliases = ['nasm']
filenames = ['*.asm', '*.ASM', '*.nasm']
mimetypes = ['text/x-nasm']
url = 'https://nasm.us'

# Tasm uses the same file endings, but TASM is not as common as NASM, so
# we prioritize NASM higher by default
Expand Down Expand Up @@ -803,6 +811,7 @@ class NasmObjdumpLexer(ObjdumpLexer):
aliases = ['objdump-nasm']
filenames = ['*.objdump-intel']
mimetypes = ['text/x-nasm-objdump']
url = 'https://www.gnu.org/software/binutils'

tokens = _objdump_lexer_tokens(NasmLexer)

Expand All @@ -815,6 +824,7 @@ class TasmLexer(RegexLexer):
aliases = ['tasm']
filenames = ['*.asm', '*.ASM', '*.tasm']
mimetypes = ['text/x-tasm']
url = 'https://en.wikipedia.org/wiki/Turbo_Assembler'

identifier = r'[@a-z$._?][\w$.?#@~]*'
hexn = r'(?:0x[0-9a-f]+|$0[0-9a-f]*|[0-9]+[0-9a-f]*h)'
Expand Down Expand Up @@ -902,6 +912,7 @@ class Ca65Lexer(RegexLexer):
name = 'ca65 assembler'
aliases = ['ca65']
filenames = ['*.s']
url = 'https://cc65.github.io'

flags = re.IGNORECASE

Expand Down
14 changes: 8 additions & 6 deletions pygments/lexers/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,7 @@ class BlitzBasicLexer(RegexLexer):

class MonkeyLexer(RegexLexer):
"""
For
`Monkey <https://en.wikipedia.org/wiki/Monkey_(programming_language)>`_
source code.
For Monkey source code.
.. versionadded:: 1.6
"""
Expand All @@ -205,6 +203,7 @@ class MonkeyLexer(RegexLexer):
aliases = ['monkey']
filenames = ['*.monkey']
mimetypes = ['text/x-monkey']
url = 'https://blitzresearch.itch.io/monkeyx'

name_variable = r'[a-z_]\w*'
name_function = r'[A-Z]\w*'
Expand Down Expand Up @@ -331,6 +330,7 @@ class CbmBasicV2Lexer(RegexLexer):
name = 'CBM BASIC V2'
aliases = ['cbmbas']
filenames = ['*.bas']
url = 'https://en.wikipedia.org/wiki/Commodore_BASIC'

flags = re.IGNORECASE

Expand Down Expand Up @@ -362,9 +362,7 @@ def analyse_text(text):

class QBasicLexer(RegexLexer):
"""
For
`QBasic <http://en.wikipedia.org/wiki/QBasic>`_
source code.
For QBasic source code.
.. versionadded:: 2.0
"""
Expand All @@ -373,6 +371,7 @@ class QBasicLexer(RegexLexer):
aliases = ['qbasic', 'basic']
filenames = ['*.BAS', '*.bas']
mimetypes = ['text/basic']
url = 'https://en.wikipedia.org/wiki/QBasic'

declarations = ('DATA', 'LET')

Expand Down Expand Up @@ -512,6 +511,8 @@ class VBScriptLexer(RegexLexer):
name = 'VBScript'
aliases = ['vbscript']
filenames = ['*.vbs', '*.VBS']
url = 'https://learn.microsoft.com/en-us/previous-versions/t0aew7h6(v=vs.85)'

flags = re.IGNORECASE

tokens = {
Expand Down Expand Up @@ -607,6 +608,7 @@ class BBCBasicLexer(RegexLexer):
name = 'BBC Basic'
aliases = ['bbcbasic']
filenames = ['*.bbc']
url = 'https://www.bbcbasic.co.uk/bbcbasic.html'

tokens = {
'root': [
Expand Down
2 changes: 1 addition & 1 deletion pygments/lexers/bdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
~~~~~~~~~~~~~~~~~~~
Lexer for BDD(Behavior-driven development).
More information: https://en.wikipedia.org/wiki/Behavior-driven_development
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
Expand All @@ -27,6 +26,7 @@ class BddLexer(RegexLexer):
aliases = ['bdd']
filenames = ['*.feature']
mimetypes = ['text/x-bdd']
url = 'https://en.wikipedia.org/wiki/Behavior-driven_development'

step_keywords = (r'Given|When|Then|Add|And|Feature|Scenario Outline|'
r'Scenario|Background|Examples|But')
Expand Down
3 changes: 2 additions & 1 deletion pygments/lexers/berry.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@

class BerryLexer(RegexLexer):
"""
For `berry <http://github.com/berry-lang/berry>`_ source code.
For Berry source code.
.. versionadded:: 2.12.0
"""
name = 'Berry'
aliases = ['berry', 'be']
filenames = ['*.be']
mimetypes = ['text/x-berry', 'application/x-berry']
url = 'https://berry-lang.github.io'

_name = r'\b[^\W\d]\w*'

Expand Down
2 changes: 2 additions & 0 deletions pygments/lexers/bibtex.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class BibTeXLexer(ExtendedRegexLexer):
filenames = ['*.bib']
mimetypes = ["text/x-bibtex"]
flags = re.IGNORECASE
url = 'https://texfaq.org/FAQ-BibTeXing'

ALLOWED_CHARS = r'@!$&*+\-./:;<>?\[\\\]^`|~'
IDENTIFIER = '[{}][{}]*'.format('a-z_' + ALLOWED_CHARS, r'\w' + ALLOWED_CHARS)
Expand Down Expand Up @@ -124,6 +125,7 @@ class BSTLexer(RegexLexer):
aliases = ['bst', 'bst-pybtex']
filenames = ['*.bst']
flags = re.IGNORECASE | re.MULTILINE
url = 'https://texfaq.org/FAQ-BibTeXing'

tokens = {
'root': [
Expand Down
3 changes: 2 additions & 1 deletion pygments/lexers/boa.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@

class BoaLexer(RegexLexer):
"""
Lexer for the `Boa <http://boa.cs.iastate.edu/docs/>`_ language.
Lexer for the Boa language.
.. versionadded:: 2.4
"""
name = 'Boa'
aliases = ['boa']
filenames = ['*.boa']
url = 'https://boa.cs.iastate.edu/docs'

reserved = words(
('input', 'output', 'of', 'weight', 'before', 'after', 'stop',
Expand Down
23 changes: 14 additions & 9 deletions pygments/lexers/business.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class CobolLexer(RegexLexer):
aliases = ['cobol']
filenames = ['*.cob', '*.COB', '*.cpy', '*.CPY']
mimetypes = ['text/x-cobol']
url = 'https://en.wikipedia.org/wiki/COBOL'

flags = re.IGNORECASE | re.MULTILINE

# Data Types: by PICTURE and USAGE
Expand Down Expand Up @@ -228,6 +230,8 @@ class CobolFreeformatLexer(CobolLexer):
aliases = ['cobolfree']
filenames = ['*.cbl', '*.CBL']
mimetypes = []
url = 'https://opencobol.add1tocobol.com'

flags = re.IGNORECASE | re.MULTILINE

tokens = {
Expand All @@ -247,6 +251,7 @@ class ABAPLexer(RegexLexer):
aliases = ['abap']
filenames = ['*.abap', '*.ABAP']
mimetypes = ['text/x-abap']
url = 'https://community.sap.com/topics/abap'

flags = re.IGNORECASE | re.MULTILINE

Expand Down Expand Up @@ -448,15 +453,15 @@ class ABAPLexer(RegexLexer):

class OpenEdgeLexer(RegexLexer):
"""
Lexer for `OpenEdge ABL (formerly Progress)
<http://web.progress.com/en/openedge/abl.html>`_ source code.
Lexer for OpenEdge ABL (formerly Progress) source code.
.. versionadded:: 1.5
"""
name = 'OpenEdge ABL'
aliases = ['openedge', 'abl', 'progress']
filenames = ['*.p', '*.cls']
mimetypes = ['text/x-openedge', 'application/x-openedge']
url = 'https://www.progress.com/openedge/features/abl'

types = (r'(?i)(^|(?<=[^\w\-]))(CHARACTER|CHAR|CHARA|CHARAC|CHARACT|CHARACTE|'
r'COM-HANDLE|DATE|DATETIME|DATETIME-TZ|'
Expand Down Expand Up @@ -517,10 +522,7 @@ def analyse_text(text):

class GoodDataCLLexer(RegexLexer):
"""
Lexer for `GoodData-CL
<https://github.com/gooddata/GoodData-CL/raw/master/cli/src/main/resources/\
com/gooddata/processor/COMMANDS.txt>`_
script files.
Lexer for GoodData-CL script files.
.. versionadded:: 1.4
"""
Expand All @@ -529,8 +531,12 @@ class GoodDataCLLexer(RegexLexer):
aliases = ['gooddata-cl']
filenames = ['*.gdc']
mimetypes = ['text/x-gooddata-cl']
url = 'https://github.com/gooddata/GoodData-CL'

flags = re.IGNORECASE

# Syntax:
# https://github.com/gooddata/GoodData-CL/raw/master/cli/src/main/resources/com/gooddata/processor/COMMANDS.txt
tokens = {
'root': [
# Comments
Expand Down Expand Up @@ -564,9 +570,7 @@ class GoodDataCLLexer(RegexLexer):

class MaqlLexer(RegexLexer):
"""
Lexer for `GoodData MAQL
<https://secure.gooddata.com/docs/html/advanced.metric.tutorial.html>`_
scripts.
Lexer for GoodData MAQL scripts.
.. versionadded:: 1.4
"""
Expand All @@ -575,6 +579,7 @@ class MaqlLexer(RegexLexer):
aliases = ['maql']
filenames = ['*.maql']
mimetypes = ['text/x-gooddata-maql', 'application/x-gooddata-maql']
url = 'https://help.gooddata.com/doc/enterprise/en/dashboards-and-insights/maql-analytical-query-language'

flags = re.IGNORECASE
tokens = {
Expand Down
Loading

0 comments on commit 446b45c

Please sign in to comment.