| Home | Trees | Indices | Help |
|
|---|
|
|
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 #
4 # Copyright 2008 Zuza Software Foundation
5 #
6 # This file is part of translate.
7 #
8 # translate is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # translate is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with translate; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 import re
23
24 charset_re = re.compile('CHARACTER_SET[ ]+(?P<charset>.*)')
25 header_item_or_end_re = re.compile('(((?P<key>[^ ]+)(?P<space>[ ]*:[ ]*)(?P<value>.*))|(?P<end_comment>[*]/))')
26 header_item_re = re.compile('(?P<key>[^ ]+)(?P<space>[ ]*:[ ]*)(?P<value>.*)')
27 string_entry_re = re.compile('(?P<start>rls_string[ ]+)(?P<id>[^ ]+)(?P<space>[ ]+)(?P<str>.*)')
28
29
31 return x
32
33
35
37 self.f = f
38 self.charset = charset
39 self.current_line = u''
40 self.read_hook = read_hook
41 self.read_line()
42
48
49
51 result = f(ps.current_line)
52 while test(result):
53 ps.read_line()
54 result = f(ps.current_line)
55 return result
56
57
60
61
63 if ps.current_line.startswith('// DO NOT TRANSLATE'):
64 ps.read_line()
65 read_while(ps, identity, lambda line: not line.startswith('// DO NOT TRANSLATE'))
66 ps.read_line()
67 eat_whitespace(ps)
68
69
76
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Tue Apr 12 18:12:04 2011 | http://epydoc.sourceforge.net |