class Modula2Lexer(RegexLexer):
For Modula-2 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
m2iso
m2r10
objm2
The PIM and ISO dialect options may be qualified with a language extension.
Language Extensions:
+aglet
+gm2
+p1
+xds
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
$ pygmentize -O full,dialect=m2iso+p1 -f rtf -o /path/to/output /path/to/input
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:
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
algol_nu
The lexer automatically performs the required lowercase conversion when this mode is activated.
Example:
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:
Method | __init__ |
Undocumented |
Method | analyse_text |
It's Pascal-like, but does not use FUNCTION -- uses PROCEDURE instead. |
Method | get_dialect_from_dialect_tag |
Undocumented |
Method | get_tokens_unprocessed |
Split text into (tokentype, text) pairs. |
Method | set_dialect |
Undocumented |
Class Variable | aglet_additional_builtins |
Undocumented |
Class Variable | aglet_additional_pseudo_builtins |
Undocumented |
Class Variable | aglet_additional_reserved_words |
Undocumented |
Class Variable | aliases |
Undocumented |
Class Variable | builtins_db |
Undocumented |
Class Variable | common_builtins |
Undocumented |
Class Variable | common_pseudo_builtins |
Undocumented |
Class Variable | common_reserved_words |
Undocumented |
Class Variable | dialects |
Undocumented |
Class Variable | filenames |
Undocumented |
Class Variable | flags |
Undocumented |
Class Variable | gm2_additional_builtins |
Undocumented |
Class Variable | gm2_additional_pseudo_builtins |
Undocumented |
Class Variable | gm2_additional_reserved_words |
Undocumented |
Class Variable | iso_additional_builtins |
Undocumented |
Class Variable | iso_additional_pseudo_builtins |
Undocumented |
Class Variable | iso_additional_reserved_words |
Undocumented |
Class Variable | iso_lexemes_to_reject |
Undocumented |
Class Variable | iso_stdlib_const_identifiers |
Undocumented |
Class Variable | iso_stdlib_module_identifiers |
Undocumented |
Class Variable | iso_stdlib_proc_identifiers |
Undocumented |
Class Variable | iso_stdlib_type_identifiers |
Undocumented |
Class Variable | iso_stdlib_var_identifiers |
Undocumented |
Class Variable | lexemes_to_reject_db |
Undocumented |
Class Variable | m2r10_additional_builtins |
Undocumented |
Class Variable | m2r10_additional_pseudo_builtins |
Undocumented |
Class Variable | m2r10_additional_reserved_words |
Undocumented |
Class Variable | m2r10_lexemes_to_reject |
Undocumented |
Class Variable | m2r10_stdlib_adt_identifiers |
Undocumented |
Class Variable | m2r10_stdlib_blueprint_identifiers |
Undocumented |
Class Variable | m2r10_stdlib_const_identifiers |
Undocumented |
Class Variable | m2r10_stdlib_module_identifiers |
Undocumented |
Class Variable | m2r10_stdlib_proc_identifiers |
Undocumented |
Class Variable | m2r10_stdlib_type_identifiers |
Undocumented |
Class Variable | m2r10_stdlib_var_identifiers |
Undocumented |
Class Variable | mimetypes |
Undocumented |
Class Variable | name |
Undocumented |
Class Variable | objm2_additional_builtins |
Undocumented |
Class Variable | objm2_additional_pseudo_builtins |
Undocumented |
Class Variable | objm2_additional_reserved_words |
Undocumented |
Class Variable | objm2_lexemes_to_reject |
Undocumented |
Class Variable | p1_additional_builtins |
Undocumented |
Class Variable | p1_additional_pseudo_builtins |
Undocumented |
Class Variable | p1_additional_reserved_words |
Undocumented |
Class Variable | pim_additional_builtins |
Undocumented |
Class Variable | pim_additional_pseudo_builtins |
Undocumented |
Class Variable | pim_additional_reserved_words |
Undocumented |
Class Variable | pim_lexemes_to_reject |
Undocumented |
Class Variable | pim_stdlib_const_identifiers |
Undocumented |
Class Variable | pim_stdlib_module_identifiers |
Undocumented |
Class Variable | pim_stdlib_proc_identifiers |
Undocumented |
Class Variable | pim_stdlib_type_identifiers |
Undocumented |
Class Variable | pim_stdlib_var_identifiers |
Undocumented |
Class Variable | pseudo_builtins_db |
Undocumented |
Class Variable | reserved_words_db |
Undocumented |
Class Variable | stdlib_adts_db |
Undocumented |
Class Variable | stdlib_constants_db |
Undocumented |
Class Variable | stdlib_modules_db |
Undocumented |
Class Variable | stdlib_procedures_db |
Undocumented |
Class Variable | stdlib_types_db |
Undocumented |
Class Variable | stdlib_variables_db |
Undocumented |
Class Variable | tokens |
Undocumented |
Class Variable | xds_additional_builtins |
Undocumented |
Class Variable | xds_additional_pseudo_builtins |
Undocumented |
Class Variable | xds_additional_reserved_words |
Undocumented |
Instance Variable | adts |
Undocumented |
Instance Variable | algol_publication_mode |
Undocumented |
Instance Variable | builtins |
Undocumented |
Instance Variable | constants |
Undocumented |
Instance Variable | dialect |
Undocumented |
Instance Variable | dialect_set_by_tag |
Undocumented |
Instance Variable | lexemes_to_reject |
Undocumented |
Instance Variable | modules |
Undocumented |
Instance Variable | procedures |
Undocumented |
Instance Variable | pseudo_builtins |
Undocumented |
Instance Variable | reserved_words |
Undocumented |
Instance Variable | treat_stdlib_adts_as_builtins |
Undocumented |
Instance Variable | types |
Undocumented |
Instance Variable | variables |
Undocumented |
Inherited from Lexer
(via RegexLexer
):
Method | get_tokens |
Return an iterable of (tokentype, value) pairs generated from text . If unfiltered is set to True , the filtering mechanism is bypassed even if filters are defined. |
Class Variable | alias_filenames |
Undocumented |
Method | __repr__ |
Undocumented |
Method | add_filter |
Add a new stream filter to this lexer. |
Class Variable | priority |
Undocumented |
Instance Variable | encoding |
Undocumented |
Instance Variable | ensurenl |
Undocumented |
Instance Variable | filters |
Undocumented |
Instance Variable | options |
Undocumented |
Instance Variable | stripall |
Undocumented |
Instance Variable | stripnl |
Undocumented |
Instance Variable | tabsize |
Undocumented |
pygments.lexer.Lexer.analyse_text