File: //usr/lib/python3/dist-packages/pygments/lexers/__pycache__/modula2.cpython-310.pyc
o
���aJ� � @ sr d Z ddlZddlmZmZ ddlmZmZ ddlm Z m
Z
mZmZm
Z
mZmZmZmZ dgZG dd� de�ZdS )z�
pygments.lexers.modula2
~~~~~~~~~~~~~~~~~~~~~~~
Multi-Dialect Lexer for Modula-2.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
� N)�
RegexLexer�include)�get_bool_opt�get_list_opt) �Text�Comment�Operator�Keyword�Name�String�Number�Punctuation�Error�Modula2Lexerc @ s� e Zd ZdZdZddgZddgZdgZej ej
B Zdefd efgd
e
jfde
jfde
jfd
e
jfde
jfde
jfde
jfde
jfgdefgdejfdejfgdejfdejfdejfgdejfdejfdejfgdejfdejfgdefdefdefd efd!efd"efd#efd$efd%efd&efg
d'efd(efd)efd*efd+efd,efd-efd.efd/efg d0efd1efd2efd3efd4efd5efd6efgd7efd8efd9efgd:e
jfd;e
jfd<e
jfgd=e
jfd>e
jfged?�ed@�edA�edB�edC�edD�edE�edF�edG�edH�edI�edJ�edK�g
dL�ZdMZdNZ dOZ!dPZ"dQZ#dRZ$dSZ%dTZ&dUZ'dVZ(dWZ)dXZ*dYZ+dZZ,d[Z-d\Z.d]Z/d^Z0d_Z1d_Z2d`Z3d_Z4daZ5dbZ6d_Z7d_Z8d_Z9dcZ:ddZ;deZ<dfZ=dgZ>dhZ?diZ@djZAdkZBd_ZCd_ZDd_ZEd_ZFd_ZGdlZHdmZIdnZJdoZKdpZLdqZMdrZNdsZOd_e"fe&fe*fe.fe&fe"fe&fe&fds� ZPee#e'e+fee#fee'fee+fee+e/fee'e2fee#e5fee'e8fee'e;fds� ZQe e$e(e,fe e$fe e(fe e,fe e,e0fe e(e3fe e$e6fe e(e9fe e(e<fds� ZRe!e%e)e-fe!e%fe!e)fe!e-fe!e-e1fe!e)e4fe!e%e7fe!e)e:fe!e)e=fds� ZSd_d_d_eHfeHfd_d_d_d_ds� ZTd_e>feCfeIeJeHfeIeJfeCfe>feCfeCfds� ZUd_e?feDfeKfeKfeDfe?feDfeDfds� ZVd_e@feEfeLfeLfeEfe@feEfeEfds� ZWd_eAfeFfeMfeMfeFfeAfeFfeFfds� ZXd_eBfeGfeNfeNfeGfeBfeGfeGfds� ZYdtdu� ZZdvdw� Z[dxdy� Z\dzd{� Z]d|d}� Z^d~S )r a�
For `Modula-2 <http://www.modula2.org/>`_ source code.
The Modula-2 lexer supports several dialects. By default, it operates in
fallback mode, recognising the *combined* literals, punctuation symbols
and operators of all supported dialects, and the *combined* reserved words
and builtins of PIM Modula-2, ISO Modula-2 and Modula-2 R10, while not
differentiating between library defined identifiers.
To select a specific dialect, a dialect option may be passed
or a dialect tag may be embedded into a source file.
Dialect Options:
`m2pim`
Select PIM Modula-2 dialect.
`m2iso`
Select ISO Modula-2 dialect.
`m2r10`
Select Modula-2 R10 dialect.
`objm2`
Select Objective Modula-2 dialect.
The PIM and ISO dialect options may be qualified with a language extension.
Language Extensions:
`+aglet`
Select Aglet Modula-2 extensions, available with m2iso.
`+gm2`
Select GNU Modula-2 extensions, available with m2pim.
`+p1`
Select p1 Modula-2 extensions, available with m2iso.
`+xds`
Select XDS Modula-2 extensions, available with m2iso.
Passing a Dialect Option via Unix Commandline Interface
Dialect options may be passed to the lexer using the `dialect` key.
Only one such option should be passed. If multiple dialect options are
passed, the first valid option is used, any subsequent options are ignored.
Examples:
`$ pygmentize -O full,dialect=m2iso -f html -o /path/to/output /path/to/input`
Use ISO dialect to render input to HTML output
`$ pygmentize -O full,dialect=m2iso+p1 -f rtf -o /path/to/output /path/to/input`
Use ISO dialect with p1 extensions to render input to RTF output
Embedding a Dialect Option within a source file
A dialect option may be embedded in a source file in form of a dialect
tag, a specially formatted comment that specifies a dialect option.
Dialect Tag EBNF::
dialectTag :
OpeningCommentDelim Prefix dialectOption ClosingCommentDelim ;
dialectOption :
'm2pim' | 'm2iso' | 'm2r10' | 'objm2' |
'm2iso+aglet' | 'm2pim+gm2' | 'm2iso+p1' | 'm2iso+xds' ;
Prefix : '!' ;
OpeningCommentDelim : '(*' ;
ClosingCommentDelim : '*)' ;
No whitespace is permitted between the tokens of a dialect tag.
In the event that a source file contains multiple dialect tags, the first
tag that contains a valid dialect option will be used and any subsequent
dialect tags will be ignored. Ideally, a dialect tag should be placed
at the beginning of a source file.
An embedded dialect tag overrides a dialect option set via command line.
Examples:
``(*!m2r10*) DEFINITION MODULE Foobar; ...``
Use Modula2 R10 dialect to render this source file.
``(*!m2pim+gm2*) DEFINITION MODULE Bazbam; ...``
Use PIM dialect with GNU extensions to render this source file.
Algol Publication Mode:
In Algol publication mode, source text is rendered for publication of
algorithms in scientific papers and academic texts, following the format
of the Revised Algol-60 Language Report. It is activated by passing
one of two corresponding styles as an option:
`algol`
render reserved words lowercase underline boldface
and builtins lowercase boldface italic
`algol_nu`
render reserved words lowercase boldface (no underlining)
and builtins lowercase boldface italic
The lexer automatically performs the required lowercase conversion when
this mode is activated.
Example:
``$ pygmentize -O full,style=algol -f latex -o /path/to/output /path/to/input``
Render input file in Algol publication mode to LaTeX output.
Rendering Mode of First Class ADT Identifiers:
The rendering of standard library first class ADT identifiers is controlled
by option flag "treat_stdlib_adts_as_builtins".
When this option is turned on, standard library ADT identifiers are rendered
as builtins. When it is turned off, they are rendered as ordinary library
identifiers.
`treat_stdlib_adts_as_builtins` (default: On)
The option is useful for dialects that support ADTs as first class objects
and provide ADTs in the standard library that would otherwise be built-in.
At present, only Modula-2 R10 supports library ADTs as first class objects
and therefore, no ADT identifiers are defined for any other dialects.
Example:
``$ pygmentize -O full,dialect=m2r10,treat_stdlib_adts_as_builtins=Off ...``
Render standard library ADTs as ordinary library types.
.. versionadded:: 1.3
.. versionchanged:: 2.1
Added multi-dialect support.
zModula-2�modula2�m2z*.defz*.modztext/x-modula2z\n+z\s+z\(\*!m2pim\*\)z\(\*!m2iso\*\)z\(\*!m2r10\*\)z\(\*!objm2\*\)z\(\*!m2iso\+aglet\*\)z\(\*!m2pim\+gm2\*\)z\(\*!m2iso\+p1\*\)z\(\*!m2iso\+xds\*\)z([a-zA-Z_$][\w$]*)z0b[01]+(\'[01]+)*z0[ux][0-9A-F]+(\'[0-9A-F]+)*z>[0-9]+(\'[0-9]+)*\.[0-9]+(\'[0-9]+)*[eE][+-]?[0-9]+(\'[0-9]+)*z$[0-9]+(\'[0-9]+)*\.[0-9]+(\'[0-9]+)*z[0-9]+(\'[0-9]+)*z[0-7]+Bz[0-7]+Cz
[0-9A-F]+Hz"(\\\\|\\[^\\]|[^"\\])*"z'(\\\\|\\[^\\]|[^'\\])*'z\*\.z\+>�<>�<=�>=�==�::�:=z\+\+�--z[+-]z[*/]z\\z[=#<>]z\^�@�&�~�`z\.\.�<<�>>�->z\|#�##z\|\*z[()\[\]{},.:;|]�!z\?z^//.*?\nz\(\*([^$].*?)\*\)z/\*(.*?)\*/z <\*.*?\*>z
\(\*\$.*?\*\)�
whitespace�dialecttags�pragmas�comments�identifiers�suffixed_number_literals�prefixed_number_literals�plain_number_literals�string_literals�digraph_punctuation�digraph_operators�unigraph_punctuation�unigraph_operators)r"