From c1f4d3f68787fa2ae964c468d28a84df37319b28 Mon Sep 17 00:00:00 2001 From: orbitalquark <70453897+orbitalquark@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:30:49 -0400 Subject: lexers: switch to tabs for indentation --- lua/lexers/python.lua | 118 +++++++++++++++++++++++++------------------------- 1 file changed, 59 insertions(+), 59 deletions(-) (limited to 'lua/lexers/python.lua') diff --git a/lua/lexers/python.lua b/lua/lexers/python.lua index b870502..bdb03f1 100644 --- a/lua/lexers/python.lua +++ b/lua/lexers/python.lua @@ -9,17 +9,17 @@ local lex = lexer.new(..., {fold_by_indentation = true}) -- Classes. lex:add_rule('classdef', lex:tag(lexer.KEYWORD, 'class') * lex:get_rule('whitespace') * - lex:tag(lexer.CLASS, lexer.word)) + lex:tag(lexer.CLASS, lexer.word)) -- Keywords. lex:add_rule('keyword', lex:tag(lexer.KEYWORD, lex:word_match(lexer.KEYWORD)) + - lex:tag(lexer.KEYWORD .. '.soft', lex:word_match(lexer.KEYWORD .. '.soft'))) + lex:tag(lexer.KEYWORD .. '.soft', lex:word_match(lexer.KEYWORD .. '.soft'))) -- Functions. local builtin_func = -B('.') * - lex:tag(lexer.FUNCTION_BUILTIN, lex:word_match(lexer.FUNCTION_BUILTIN)) + lex:tag(lexer.FUNCTION_BUILTIN, lex:word_match(lexer.FUNCTION_BUILTIN)) local special_func = lex:tag(lexer.FUNCTION_BUILTIN .. '.special', - lex:word_match(lexer.FUNCTION_BUILTIN .. '.special')) + lex:word_match(lexer.FUNCTION_BUILTIN .. '.special')) local func = lex:tag(lexer.FUNCTION, lexer.word) local method = B('.') * lex:tag(lexer.FUNCTION_METHOD, lexer.word) lex:add_rule('function', (builtin_func + special_func + method + func) * #(lexer.space^0 * '(')) @@ -34,7 +34,7 @@ local sq_str = lexer.range("'", true) local dq_str = lexer.range('"', true) local tq_str = lexer.range("'''") + lexer.range('"""') lex:add_rule('string', lex:tag(lexer.STRING, (S('fFrRbBrR') * S('rRfFrRbB') + S('ruRUfFbB'))^-1 * - (tq_str + sq_str + dq_str))) + (tq_str + sq_str + dq_str))) -- Identifiers. lex:add_rule('identifier', lex:tag(lexer.IDENTIFIER, lexer.word)) @@ -53,74 +53,74 @@ lex:add_rule('operator', lex:tag(lexer.OPERATOR, S('!@%^&*()[]{}-=+/|:;.,<>~'))) -- Word lists. lex:set_word_list(lexer.KEYWORD, { - 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', - 'else', 'except', 'False', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', - 'lambda', 'None', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'True', 'try', 'while', - 'with', 'yield' + 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', + 'else', 'except', 'False', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', + 'lambda', 'None', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'True', 'try', 'while', + 'with', 'yield' }) lex:set_word_list(lexer.KEYWORD .. '.soft', '_ case match') lex:set_word_list(lexer.FUNCTION_BUILTIN, { - 'abs', 'aiter', 'all', 'any', 'anext', 'ascii', 'bin', 'bool', 'breakpoint', 'bytearray', 'bytes', - 'callable', 'chr', 'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', - 'enumerate', 'eval', 'exec', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', - 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', - 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', - 'pow', 'print', 'property', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', - 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip', '__import__' + 'abs', 'aiter', 'all', 'any', 'anext', 'ascii', 'bin', 'bool', 'breakpoint', 'bytearray', 'bytes', + 'callable', 'chr', 'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', + 'enumerate', 'eval', 'exec', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', + 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', + 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', + 'pow', 'print', 'property', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', + 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip', '__import__' }) lex:set_word_list(lexer.FUNCTION_BUILTIN .. '.special', { - '__new__', '__init__', '__del__', '__repr__', '__str__', '__bytes', '__format__', '__lt__', - '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__hash__', '__bool__', -- - '__getattr__', '__getattribute__', '__setattr__', '__delattr__', '__dir__', -- - '__get__', '__set__', '__delete__', '__slots__', -- - '__init_subclass__', '__set_name__', -- - '__instancecheck__', '__subclasscheck__', -- - '__class_getitem__', -- - '__call__', -- - '__len__', '__length_hint', '__getitem__', '__setitem__', '__delitem__', '__missing__', - '__iter__', '__reversed__', '__contains__', -- - '__add__', '__sub__', '__mul__', '__matmul__', '__truediv__', '__floordiv__', '__mod__', - '__divmod__', '__pow__', '__lshift__', '__rshift__', '__and__', '__xor__', '__or__', -- - '__radd__', '__rsub__', '__rmul__', '__rmatmul__', '__rtruediv__', '__rfloordiv__', '__rmod__', - '__rdivmod__', '__rpow__', '__rlshift__', '__rrshift__', '__rand__', '__rxor__', '__ror__', -- - '__iadd__', '__isub__', '__imul__', '__imatmul__', '__itruediv__', '__ifloordiv__', '__imod__', - '__idivmod__', '__ipow__', '__ilshift__', '__irshift__', '__iand__', '__ixor__', '__ior__', -- - '__neg__', '__pos__', '__abs__', '__invert__', '__complex__', '__int__', '__float__', '__index__', - '__round__', '__trunc__', '__floor__', '__ceil__', -- - '__enter__', '__exit__', -- - '__match_args__', -- - '__await__', -- - '__aiter__', '__anext__', '__aenter__', '__aexit__' -- + '__new__', '__init__', '__del__', '__repr__', '__str__', '__bytes', '__format__', '__lt__', + '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__hash__', '__bool__', -- + '__getattr__', '__getattribute__', '__setattr__', '__delattr__', '__dir__', -- + '__get__', '__set__', '__delete__', '__slots__', -- + '__init_subclass__', '__set_name__', -- + '__instancecheck__', '__subclasscheck__', -- + '__class_getitem__', -- + '__call__', -- + '__len__', '__length_hint', '__getitem__', '__setitem__', '__delitem__', '__missing__', + '__iter__', '__reversed__', '__contains__', -- + '__add__', '__sub__', '__mul__', '__matmul__', '__truediv__', '__floordiv__', '__mod__', + '__divmod__', '__pow__', '__lshift__', '__rshift__', '__and__', '__xor__', '__or__', -- + '__radd__', '__rsub__', '__rmul__', '__rmatmul__', '__rtruediv__', '__rfloordiv__', '__rmod__', + '__rdivmod__', '__rpow__', '__rlshift__', '__rrshift__', '__rand__', '__rxor__', '__ror__', -- + '__iadd__', '__isub__', '__imul__', '__imatmul__', '__itruediv__', '__ifloordiv__', '__imod__', + '__idivmod__', '__ipow__', '__ilshift__', '__irshift__', '__iand__', '__ixor__', '__ior__', -- + '__neg__', '__pos__', '__abs__', '__invert__', '__complex__', '__int__', '__float__', '__index__', + '__round__', '__trunc__', '__floor__', '__ceil__', -- + '__enter__', '__exit__', -- + '__match_args__', -- + '__await__', -- + '__aiter__', '__anext__', '__aenter__', '__aexit__' -- }) lex:set_word_list(lexer.CONSTANT_BUILTIN, { - 'BaseException', 'Exception', 'Exception', 'ArithmeticError', 'BufferError', 'LookupError', -- - 'AssertionError', 'AttributeError', 'EOFError', 'FloatingPointError', 'GeneratorExit', - 'ImportError', 'ModuleNotFoundError', 'IndexError', 'KeyError', 'KeyboardInterrupt', - 'MemoryError', 'NameError', 'NotImplementedError', 'OSError', 'OverflowError', 'RecursionError', - 'ReferenceError', 'RuntimeError', 'StopIteration', 'StopAsyncIteration', 'SyntaxError', - 'IndentationError', 'TabError', 'SystemError', 'SystemExit', 'TypeError', 'UnboundLocalError', - 'UnicodeError', 'UnicodeEncodeError', 'UnicodeDecodeError', 'UnicodeTranslateError', 'ValueError', - 'ZeroDivisionError', -- - 'EnvironmentError', 'IOError', 'WindowsError', -- - 'BlockingIOError', 'ChildProcessError', 'ConnectionError', 'BrokenPipeError', - 'ConnectionAbortedError', 'ConnectionRefusedError', 'FileExistsError', 'FileNotFoundError', - 'InterruptedError', 'IsADirectoryError', 'NotADirectoryError', 'PermissionError', - 'ProcessLookupError', 'TimeoutError', -- - 'Warning', 'UserWarning', 'DeprecationWarning', 'PendingDeprecationWarning', 'SyntaxWarning', - 'RuntimeWarning', 'FutureWarning', 'ImportWarning', 'UnicodeWarning', 'BytesWarning', - 'ResourceWarning' + 'BaseException', 'Exception', 'Exception', 'ArithmeticError', 'BufferError', 'LookupError', -- + 'AssertionError', 'AttributeError', 'EOFError', 'FloatingPointError', 'GeneratorExit', + 'ImportError', 'ModuleNotFoundError', 'IndexError', 'KeyError', 'KeyboardInterrupt', + 'MemoryError', 'NameError', 'NotImplementedError', 'OSError', 'OverflowError', 'RecursionError', + 'ReferenceError', 'RuntimeError', 'StopIteration', 'StopAsyncIteration', 'SyntaxError', + 'IndentationError', 'TabError', 'SystemError', 'SystemExit', 'TypeError', 'UnboundLocalError', + 'UnicodeError', 'UnicodeEncodeError', 'UnicodeDecodeError', 'UnicodeTranslateError', 'ValueError', + 'ZeroDivisionError', -- + 'EnvironmentError', 'IOError', 'WindowsError', -- + 'BlockingIOError', 'ChildProcessError', 'ConnectionError', 'BrokenPipeError', + 'ConnectionAbortedError', 'ConnectionRefusedError', 'FileExistsError', 'FileNotFoundError', + 'InterruptedError', 'IsADirectoryError', 'NotADirectoryError', 'PermissionError', + 'ProcessLookupError', 'TimeoutError', -- + 'Warning', 'UserWarning', 'DeprecationWarning', 'PendingDeprecationWarning', 'SyntaxWarning', + 'RuntimeWarning', 'FutureWarning', 'ImportWarning', 'UnicodeWarning', 'BytesWarning', + 'ResourceWarning' }) lex:set_word_list(lexer.ATTRIBUTE, { - '__doc__', '__name__', '__qualname__', '__module__', '__defaults__', '__code__', '__globals__', - '__dict__', '__closure__', '__annotations__', '__kwdefaults__', -- - '__file__', '__bases__', -- - '__class__', -- - '__self__', '__func__' -- + '__doc__', '__name__', '__qualname__', '__module__', '__defaults__', '__code__', '__globals__', + '__dict__', '__closure__', '__annotations__', '__kwdefaults__', -- + '__file__', '__bases__', -- + '__class__', -- + '__self__', '__func__' -- }) lexer.property['scintillua.comment'] = '#' -- cgit v1.2.3