2007-03-06 10:05:38 -05:00
|
|
|
import re
|
|
|
|
|
2007-07-09 17:47:15 -04:00
|
|
|
# meta regexes
|
|
|
|
meta_chars = re.compile(r'([\.\^\$\*\+\?\{\}\(\)\[\]\|\\])')
|
|
|
|
|
2007-07-10 14:55:40 -04:00
|
|
|
# shell
|
|
|
|
shell_command = re.compile(r'^[^ ]+')
|
|
|
|
|
2007-03-06 10:05:38 -05:00
|
|
|
# whitespace regexes
|
|
|
|
leading_whitespace = re.compile('^ *')
|
|
|
|
trailing_whitespace = re.compile(' *$')
|
|
|
|
whitespace = re.compile('^ *$')
|
|
|
|
|
|
|
|
# word regexes
|
|
|
|
word = re.compile('^[A-Za-z0-9_]+$')
|
|
|
|
word_char = re.compile('^[A-Za-z0-9_]$')
|
|
|
|
|
|
|
|
# perl regexes
|
|
|
|
perl_base = re.compile("^sub ")
|
2007-07-09 17:47:15 -04:00
|
|
|
perl_hash_cleanup = re.compile(r"^( *)([^ ]+|'(?:\.|[^'\'])*'|\"(?:\.|[^\\\"]*)\")( *)(=>)( *)([^ ].*)$")
|
|
|
|
perl_assign_cleanup = re.compile(r"^( *)((?:my |our )?[^ ]+)( *)(=(?!>))( *)([^ ].*)$")
|
|
|
|
perl_function = re.compile(r"^ *sub ([A-Za-z_][A-Za-z0-9_]*)")
|
2007-03-06 10:05:38 -05:00
|
|
|
|
|
|
|
# python regexes
|
2007-07-09 17:47:15 -04:00
|
|
|
python_base = re.compile(r"^[^ ]")
|
|
|
|
python_dict_cleanup = re.compile(r"^( *)((?:[^'\":]|'(?:\.|[^\'])*'|\"(?:\.|[^\'])*)+?)( *)(:)( *)([^ ].*)$")
|
|
|
|
python_assign_cleanup = re.compile(r"^( *)([^ ]+)( *)(=)( *)([^ ].*)$")
|