equal
deleted
inserted
replaced
4 """ |
4 """ |
5 |
5 |
6 import sys |
6 import sys |
7 import re |
7 import re |
8 |
8 |
|
9 from gadict_util import ParseException |
9 |
10 |
10 class Prelude: |
11 class Prelude: |
11 """Dictionary metainfo structure.""" |
12 """Dictionary metainfo structure.""" |
12 name = None |
13 name = None |
13 about = "" |
14 about = "" |
14 urls = [] |
15 urls = [] |
15 authors = [] |
16 authors = [] |
16 licences = [] |
17 licences = [] |
17 |
18 |
18 |
|
19 class ParseException(BaseException): |
|
20 |
|
21 def __init__(self, msg, lineno=None, line=None): |
|
22 BaseException.__init__(self) |
|
23 self.msg = msg |
|
24 self.lineno = lineno |
|
25 self.line = line |
|
26 |
|
27 def __repr__(self): |
|
28 if self.lineno is None: |
|
29 return self.msg |
|
30 elif self.line is None: |
|
31 return u":{:d}:{:s}".format(self.lineno, self.msg) |
|
32 else: |
|
33 return u":{:d}: {:s}\nLINE: {:s}".format(self.lineno, self.msg, self.line) |
|
34 |
19 |
35 class Headword: |
20 class Headword: |
36 |
21 |
37 def __init__(self, headword, pron = None, attrs = None, homo = None): |
22 def __init__(self, headword, pron = None, attrs = None, homo = None): |
38 self.headword = headword |
23 self.headword = headword |