diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/listings/lstlang1.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/listings/lstlang1.sty | 80 |
1 files changed, 61 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/latex/listings/lstlang1.sty b/Master/texmf-dist/tex/latex/listings/lstlang1.sty index 938f7ef1405..97481e7d77b 100644 --- a/Master/texmf-dist/tex/latex/listings/lstlang1.sty +++ b/Master/texmf-dist/tex/latex/listings/lstlang1.sty @@ -22,7 +22,7 @@ %% programming languages to Jobst Hoffmann at <j.hoffmann@fh-aachen.de>. %% \ProvidesFile{lstlang1.sty} - [2024/03/11 1.10a listings language file] + [2024/05/25 1.10b listings language file] %% %% ACSL definition (c) 2000 by Andreas Matthias %% @@ -2944,12 +2944,16 @@ morecomment=[l]!% %% %% Python definition (c) 1998 Michael Weber %% Additional definitions (2013) Alexis Dimitriadis +%% small corrections based on +%% https://docs.python.org/2/reference/lexical_analysis.html#identifiers %% -\lst@definelanguage{Python}{% - morekeywords={access, and, break, class, continue, def, del, elif, else,% - except, exec, finally, for, from, global, if, import, in, is, lambda,% - not, or, pass, print, raise, return, try, while},% - % Built-ins +\lst@definelanguage[2]{Python}{% + morekeywords={and, as, assert, break, class, continue, def, del, elif,% + else, except, exec, finally, for, from, global, if, import, in, is,% + lambda, not, or, pass, print, raise, return, try, while, with, yield},% + % Built-ins according to + % http://docs.python.org/2/library/functions.html, + % the last five entries are known as advanced or not essential morekeywords=[2]{abs, all, any, basestring, bin, bool, bytearray,% callable, chr, classmethod, cmp, compile, complex, delattr, dict, dir,% divmod, enumerate, eval, execfile, file, filter, float, format,% @@ -2958,22 +2962,60 @@ morecomment=[l]!% memoryview, min, next, object, oct, open, ord, pow, property, range,% raw_input, reduce, reload, repr, reversed, round, set, setattr, slice,% sorted, staticmethod, str, sum, super, tuple, type, unichr, unicode,% - vars, xrange, zip, apply, buffer, coerce, intern},% + vars, xrange, zip, __import__, apply, buffer, coerce, intern},% sensitive=true,% morecomment=[l]\#,% + morestring=[s]{'''}{'''},% used for documentation text + % (multiline strings) + morestring=[s]{"""}{"""},% added by Philipp Matthias Hahn morestring=[b]',% - morestring=[b]",% - morecomment=[s]{'''}{'''},% used for documentation text - % (mulitiline strings) - morecomment=[s]{"""}{"""},% added by Philipp Matthias Hahn - morestring=[s]{r'}{'},% `raw' strings - morestring=[s]{r"}{"},% - morestring=[s]{r'''}{'''},% - morestring=[s]{r"""}{"""},% - morestring=[s]{u'}{'},% unicode strings - morestring=[s]{u"}{"},% - morestring=[s]{u'''}{'''},% - morestring=[s]{u"""}{"""}% + morestring=[b]"% +} +\lst@definelanguage[3]{Python}[2]{Python}{% + % keywords + deletekeywords={exec, print}, + morekeywords={False, None, True, async, await, nonlocal, + match, case}, + % built-in functions + deletekeywords=[2]{apply, basestring, buffer, cmp, coerce, execfile, % + file, intern, long, raw_input, reduce, reload, unichr, unicode, xrange}, + morekeywords=[2]{aiter, anext, ascii, breakpoint, bytes, exec}, + % `raw' strings + morestring=[s]{r'}{'}, + morestring=[s]{r"}{"}, + morestring=[s]{r'''}{'''}, + morestring=[s]{r"""}{"""}, + morestring=[s]{R'}{'}, + morestring=[s]{R"}{"}, + morestring=[s]{R'''}{'''}, + morestring=[s]{R"""}{"""}, + % Unicode strings + morestring=[s]{u'}{'}, + morestring=[s]{u"}{"}, + morestring=[s]{u'''}{'''}, + morestring=[s]{u"""}{"""}, + morestring=[s]{U'}{'}, + morestring=[s]{U"}{"}, + morestring=[s]{U'''}{'''}, + morestring=[s]{U"""}{"""}, + % Format strings + morestring=[s]{f'}{'}, + morestring=[s]{f"}{"}, + morestring=[s]{f'''}{'''}, + morestring=[s]{f"""}{"""}, + morestring=[s]{F'}{'}, + morestring=[s]{F"}{"}, + morestring=[s]{F'''}{'''}, + morestring=[s]{F"""}{"""}, + % Byte literals + morestring=[s]{b'}{'}, + morestring=[s]{b"}{"}, + morestring=[s]{b'''}{'''}, + morestring=[s]{b"""}{"""}, + morestring=[s]{B'}{'}, + morestring=[s]{B"}{"}, + morestring=[s]{B'''}{'''}, + morestring=[s]{B"""}{"""}, }% %% %% Scilab definition (c) 2002,2003 Jean-Philippe Grivet |