Package bmrblib :: Package pystarlib :: Module Text
[hide private]
[frames] | no frames]

Module Text

source code

Classes for dealing with STAR syntax


Author: $Author: jurgenfd $

Functions [hide private]
 
pattern_unquoted_find(text, pattern, pos=0) source code
 
tag_value_quoted_parse(text, pos) source code
 
tag_value_parse(text, pos) source code
 
semicolon_block_replace(matchobj) source code
 
semicolon_block_collapse(text) source code
 
semicolon_block_expand(text) source code
 
quotes_add(text) source code
 
quotes_strip(text) source code
 
semicolons_add(text, possible_bad_char=None) source code
 
comments_strip(text) source code
 
_comments_strip_line(line) source code
 
nmrView_compress(text) source code
Variables [hide private]
  ___revision__ = '$Revision: 13 $'
  ___date__ = '$Date: 2007-08-22 20:59:28 +0200 (Wed, 22 Aug 200...
  verbosity = 2
  prepending_string = '[raw] '
  FREE = 0
  SINGLE = 1
  DOUBLE = 2
  singleq = '\''
  doubleq = '"'
  sharp = '#'
  space = ' '
  eol_string = '<eol-string>'
  eol_string_length = 12
  pattern_semicolon_block = re.compile(r'(?msx)^;.+?^;')
  pattern_eol_string = re.compile(r'(?m)<eol-string>')
  pattern_quotes_needed = re.compile(r'[\s\'"]|^_|^#')
  pattern_quotes_needed_2 = re.compile(r'[\s\'"]|^_|,_|,#')
  pattern_eoline_etcet = re.compile(r'[\n\r\v\f]')
  pattern_single_qoute = re.compile(r'\'')
  pattern_double_qoute = re.compile(r'"')
  pattern_save_begin = re.compile(r'save_(\S+)\s+')
  pattern_save_end = re.compile(r'save_\s*')
  pattern_tagtable_loop = re.compile(r'loop_\s*')
  pattern_tagtable_stop = re.compile(r'stop_\s*')
  pattern_save_begin_nws = re.compile(r'save_\S')
  pattern_save_end_nws = re.compile(r'(?:save_\s)|(?:save_$)')
  pattern_tagtable_loop_nws = re.compile(r'loop_\s')
  pattern_tag_name_nws = re.compile(r'_\S')
  pattern_tagtable_loop_2 = re.compile(r'\sloop_\s+')
  pattern_tagtable_stop_2 = re.compile(r'\sstop_\s+')
  pattern_tagname_2 = re.compile(r'\s_\S+\s+')
  pattern_tag_name = re.compile(r'(?msx)(_\S+)\s+')
  pattern_tags_loop = re.compile(r'(?mx)(?:(_\S+)\s*)+')
  pattern_tags_loop_2 = re.compile(r'(?mx)(_\S+)\s*')
  pattern_word = re.compile(r'(?m)(\S+)\s*')
  pattern_quoted = re.compile(r'(?mx)[\'"]|(?:^;)')
  pattern_quoted_2 = re.compile(r'(?mx)(?:\b[\'"])|(?:^;)')
  pattern_s_quote = re.compile(r'(?m)\'\s+')
  pattern_d_quote = re.compile(r'(?m)"\s+')
  pattern_e_semicolon = re.compile(r'(?m)<eol-string>;\s*')
  pattern_nmrView_compress_empty = re.compile(r'(?mx)\{(\s+)\}')
  pattern_nmrView_compress_questionmark = re.compile(r'(?mx)\{(\...
Searches for a regular expression in text.
  __package__ = 'bmrblib.pystarlib'

Imports: re


Variables Details [hide private]

___date__

Value:
'$Date: 2007-08-22 20:59:28 +0200 (Wed, 22 Aug 2007) $'

pattern_nmrView_compress_questionmark


Searches for a regular expression in text.
The text may not be STAR quoted and must have semicolon blocks collapsed
such that the semicolon starts at the beginning of the line.
Returns the start position of the match or -1 if it was not found or
None if there was an error.

The function will search the text from given position onwards
and checks the chars preceding (up to the line it's in) for quote style.

WARNINGS:
- Don't call it for a text that has no 
 and at least 1 other
character in it before pos (not fully tested; perhaps possible).
- I have not put in extra checks because of needed speed.
- No requirements set on what follows the pattern.

Value:
re.compile(r'(?mx)\{(\s+\?)\}')