diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2022-11-21 08:24:23 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2022-11-21 08:24:23 +0300 |
commit | 4273088e40c21bffe449fc13bfc2a8d760c3dc7d (patch) | |
tree | b6a59c6f52782f2578269135ce188e105ab1eadc /lib | |
parent | 84c7190a7a1fb9a1edd387abfafa141b7c8d4b7b (diff) | |
download | sciteco-4273088e40c21bffe449fc13bfc2a8d760c3dc7d.tar.gz |
added lexers for Python and Linux Device Trees
* The device tree lexer reuses CPP and has certain limitations.
For once it does not recognize /keywords/ and secondly it confuses
properties beginning with # as preprocessor statements.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 4 | ||||
-rw-r--r-- | lib/lexers/devicetree.tes | 25 | ||||
-rw-r--r-- | lib/lexers/python.tes | 68 |
3 files changed, 96 insertions, 1 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index 69a7c02..6e13712 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -55,6 +55,7 @@ dist_lexer_DATA = lexers/verilog.tes \ lexers/c.tes \ lexers/cpp.tes \ lexers/gob.tes \ + lexers/devicetree.tes \ lexers/test.tes \ lexers/kix.tes \ lexers/baan.tes \ @@ -87,7 +88,8 @@ dist_lexer_DATA = lexers/verilog.tes \ lexers/pov.tes \ lexers/rust.tes \ lexers/blitzbasic.tes \ - lexers/caml.tes + lexers/caml.tes \ + lexers/python.tes # This lexer is responsible for styling # womanpages and is thus useful even when omitting diff --git a/lib/lexers/devicetree.tes b/lib/lexers/devicetree.tes new file mode 100644 index 0000000..7551458 --- /dev/null +++ b/lib/lexers/devicetree.tes @@ -0,0 +1,25 @@ +!* + * Linux device tree files + * + * Limitations: + * - Keywords like /dts-v1/ cannot be highlighted. + * - Properties beginning with `#` are highlighted like preprocessor statements. + *! + +@[lexer.test.devicetree]{ + :EN*.dtsQ*"S -1 ' + :EN*.dtsiQ* +} + +@[lexer.set.devicetree]{ + ESSETILEXERcpp + :M[color.comment],1M[color.set] + :M[color.comment],2M[color.set] + :M[color.comment],3M[color.set] + :M[color.number],4M[color.set] + :M[color.keyword],5M[color.set] + :M[color.string],6M[color.set] + :M[color.string2],7M[color.set] + :M[color.preproc],9M[color.set] + :M[color.operator],10M[color.set] +} diff --git a/lib/lexers/python.tes b/lib/lexers/python.tes new file mode 100644 index 0000000..0106f5c --- /dev/null +++ b/lib/lexers/python.tes @@ -0,0 +1,68 @@ +!* Python lexer *! + +@[lexer.test.python]{ + _#!MpythonM[lexer.checkheader]"S -1 ' + :EN*.pyQ*"S -1 ' + :EN*.pywQ*"S -1 ' + :EN*.pyxQ*"S -1 ' + :EN*.pxdQ*"S -1 ' + :EN*.pxiQ* +} + +@[lexer.set.python]{ + ESSETILEXERpython + 0ESSETKEYWORDS + False None True and as assert break class continue + def del elif else except finally for from global if import in is lambda + nonlocal not or pass raise return try while with yield + cdef cimport cpdef + 2,11ESALLOCATESUBSTYLESU.s + Q.s+0ESSETIDENTIFIERS + __main__ _dummy_thread _thread abc aifc argparse + array ast asynchat asyncio asyncore atexit audioop + base64 bdb binascii binhex bisect builtins bz2 + calendar cgi cgitb chunk cmath cmd code codecs + codeop collections colorsys compileall concurrent + configparser contextlib copy copyreg crypt csv + ctypes curses datetime dbm decimal difflib dis + distutils dummy_threading email ensurepip enum + errno faulthandler fcntl filecmp fileinput fnmatch + formatter fpectl fractions ftplib functools gc getopt + getpass gettext glob grp gzip hashlib heapq hmac + html http http imaplib imghdr importlib inspect io + ipaddress itertools json keyword linecache locale + logging lzma macpath mailbox mailcap marshal math + mimetypes mmap modulefinder msilib msvcrt + multiprocessing netrc nis nntplib numbers operator + os os ossaudiodev parser pathlib pdb pickle + pickletools pipes pkgutil platform plistlib poplib posix + pprint pty pwd py_compile pyclbr queue quopri + random re readline reprlib resource rlcompleter runpy + sched select selectors shelve shlex shutil signal site + smtpd smtplib sndhdr socket socketserver spwd + sqlite3 ssl stat statistics string stringprep struct + subprocess sunau symbol symtable sys sysconfig + syslog tabnanny tarfile telnetlib tempfile termios + textwrap threading time timeit tkinter token + tokenize trace traceback tracemalloc tty turtle + types unicodedata unittest urllib uu uuid venv warnings + wave weakref webbrowser winreg winsound wsgiref + xdrlib xml xmlrpc zipfile zipimport zlib + Q.s+1ESSETIDENTIFIERS + __future__ with_statement unicode_literals print_function + :M[color.comment],1M[color.set] + :M[color.number],2M[color.set] + :M[color.string],3M[color.set] + :M[color.string2],4M[color.set] + :M[color.keyword],5M[color.set] + :M[color.string2],6M[color.set] + :M[color.string],7M[color.set] + :M[color.operator],10M[color.set] + :M[color.string],12M[color.set] + :M[color.string],16M[color.set] + :M[color.string2],17M[color.set] + :M[color.string2],18M[color.set] + :M[color.string],19M[color.set] + :M[color.variable],Q.s+0M[color.set] + :M[color.variable],Q.s+1M[color.set] +} |