diff options
| author | scoder <none@none> | 2010-02-28 10:25:56 +0100 |
|---|---|---|
| committer | scoder <none@none> | 2010-02-28 10:25:56 +0100 |
| commit | 1c46f9ab89c95fb9fcd9bfa725cd417f8fd33aa4 (patch) | |
| tree | 6fc56b4179e02ae9f2273489f9b49911652d0d42 /src | |
| parent | 5f197ab77347a8403a4e8590141d5c01dc1588c1 (diff) | |
| download | python-lxml-1c46f9ab89c95fb9fcd9bfa725cd417f8fd33aa4.tar.gz | |
[svn r4346] r5469@lenny: sbehnel | 2010-02-08 14:20:44 +0100
cleanup
--HG--
branch : trunk
Diffstat (limited to 'src')
| -rw-r--r-- | src/lxml/cssselect.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lxml/cssselect.py b/src/lxml/cssselect.py index ea5d4d4a..70226ecc 100644 --- a/src/lxml/cssselect.py +++ b/src/lxml/cssselect.py @@ -834,17 +834,17 @@ def parse_series(s): ## Tokenizing ############################################################ -_whitespace_re = re.compile(r'\s+', re.UNICODE) +_match_whitespace = re.compile(r'\s+', re.UNICODE).match -_comment_re = re.compile(r'/\*.*?\*/', re.DOTALL) +_replace_comments = re.compile(r'/\*.*?\*/', re.DOTALL).sub -_count_re = re.compile(r'[+-]?\d*n(?:[+-]\d+)?') +_match_count_number = re.compile(r'[+-]?\d*n(?:[+-]\d+)?').match def tokenize(s): pos = 0 - s = _comment_re.sub('', s) + s = _replace_comments('', s) while 1: - match = _whitespace_re.match(s, pos=pos) + match = _match_whitespace(s, pos=pos) if match: preceding_whitespace_pos = pos pos = match.end() @@ -852,7 +852,7 @@ def tokenize(s): preceding_whitespace_pos = 0 if pos >= len(s): return - match = _count_re.match(s, pos=pos) + match = _match_count_number(s, pos=pos) if match and match.group() != 'n': sym = s[pos:match.end()] yield Symbol(sym, pos) |
