2007-03-06 10:05:38 -05:00
|
|
|
import re
|
|
|
|
|
2009-04-23 11:47:54 -04:00
|
|
|
# mode stuff (emacs/vi)
|
|
|
|
auto_mode_emacs = re.compile(r'-\*- ([^ ]+) -\*-')
|
|
|
|
auto_mode_vi = re.compile('(?:vim|vi|ex):.+?(?:syntax|syn)=([^ ]+)')
|
|
|
|
|
2007-07-15 15:07:36 -04:00
|
|
|
# lexing
|
|
|
|
reserved_token_names = re.compile(r'^(?:rules|null|start|end|middle[0-9]*)$')
|
|
|
|
valid_token_name = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*$')
|
|
|
|
middle_token_name = re.compile(r'^middle([0-9]+)$')
|
|
|
|
|
2007-07-09 17:47:15 -04:00
|
|
|
# meta regexes
|
2007-07-11 04:55:54 -04:00
|
|
|
meta_chars = re.compile(r'([\.\^\$\*\+\?\{\}\(\)\[\]\|\"\'\\,])')
|
2007-07-09 17:47:15 -04:00
|
|
|
|
2007-07-10 14:55:40 -04:00
|
|
|
# shell
|
|
|
|
shell_command = re.compile(r'^[^ ]+')
|
|
|
|
|
2007-03-06 10:05:38 -05:00
|
|
|
# whitespace regexes
|
2010-07-03 23:33:05 -04:00
|
|
|
leading_whitespace = re.compile('^[ \t]*')
|
|
|
|
trailing_whitespace = re.compile(r'[ \t]*$')
|
|
|
|
whitespace = re.compile(r'^[ \t\n]*$')
|
2009-04-23 11:47:54 -04:00
|
|
|
space = re.compile('^ *$')
|
2010-07-03 23:33:05 -04:00
|
|
|
leading_whitespace2 = re.compile(r'^([ \t]*?)(.*?)\n?$')
|
|
|
|
internal_tab = re.compile(r'\t *\t')
|
2007-03-06 10:05:38 -05:00
|
|
|
|
|
|
|
# word regexes
|
2009-04-23 11:47:54 -04:00
|
|
|
word = re.compile('^[A-Za-z0-9_]+$')
|
2007-03-06 10:05:38 -05:00
|
|
|
word_char = re.compile('^[A-Za-z0-9_]$')
|
|
|
|
|
|
|
|
# perl regexes
|
2009-04-23 11:47:54 -04:00
|
|
|
perl_base = re.compile("^sub ")
|
|
|
|
perl_hash_cleanup = re.compile(r"^( *)([^ ]+|'(?:\.|[^'\'])*'|\"(?:\.|[^\\\"]*)\")( *)(=>)( *)([^ ].*)$")
|
|
|
|
perl_assign_cleanup = re.compile("^( *)((?:my |our )?[^ ]+)( *)(=(?!>))( *)([^ ].*)$")
|
|
|
|
perl_function = re.compile("^ *sub ([A-Za-z_][A-Za-z0-9_]*)")
|
2007-03-06 10:05:38 -05:00
|
|
|
|
|
|
|
# python regexes
|
2009-04-23 11:47:54 -04:00
|
|
|
python_base = re.compile("^[^ ]")
|
|
|
|
python_dict_cleanup = re.compile(r"^( *)((?:[^'\":]|'(?:\.|[^\'])*'|\"(?:\.|[^\'])*)+?)( *)(:)( *)([^ ].*)$")
|
|
|
|
python_assign_cleanup = re.compile("^( *)([^ ]+)( *)(=)( *)([^ ].*)$")
|
|
|
|
python_scope = re.compile('^( *)(class|def) ([A-Za-z_][A-Za-z0-9_]*)')
|
|
|
|
python_indent = re.compile('^( *)')
|