Lines Matching +full:- +full:j
10 _declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*').match
12 _commentclose = re.compile(r'--\s*>')
15 # An analysis of the MS-Word extensions is available at
40 # Internal -- update line number and offset. This should be
41 # called for each piece of data exactly once, in order -- in other
44 def updatepos(self, i, j): argument
45 if i >= j:
46 return j
48 nlines = rawdata.count("\n", i, j)
51 pos = rawdata.rindex("\n", i, j) # Should not fail
52 self.offset = j-(pos+1)
54 self.offset = self.offset + j-i
55 return j
59 # Internal -- parse declaration (for use by subclasses).
66 # --comment--
72 j = i + 2
73 assert rawdata[i:j] == "<!", "unexpected call to parse_declaration"
74 if rawdata[j:j+1] == ">":
76 return j + 1
77 if rawdata[j:j+1] in ("-", ""):
80 return -1
83 if rawdata[j:j+2] == '--': #comment
84 # Locate --.*-- as the body of the comment
86 elif rawdata[j] == '[': #marked section
93 decltype, j = self._scan_name(j, i)
94 if j < 0:
95 return j
98 while j < n:
99 c = rawdata[j]
102 data = rawdata[i+2:j]
111 return j + 1
113 m = _declstringlit_match(rawdata, j)
115 return -1 # incomplete
116 j = m.end()
118 name, j = self._scan_name(j, i)
120 j = j + 1
124 j = self._parse_doctype_subset(j + 1, i)
134 raise AssertionError("unexpected %r char in declaration" % rawdata[j])
135 if j < 0:
136 return j
137 return -1 # incomplete
139 # Internal -- parse a marked section
140 # Override this to handle MS-word extension syntax <![if word]>content<![endif]>
144 sectName, j = self._scan_name( i+3, i )
145 if j < 0:
146 return j
155 'unknown status keyword %r in marked section' % rawdata[i+3:j]
158 return -1
160 j = match.start(0)
161 self.unknown_decl(rawdata[i+3: j])
164 # Internal -- parse comment, return length or -1 if not terminated
167 if rawdata[i:i+4] != '<!--':
171 return -1
173 j = match.start(0)
174 self.handle_comment(rawdata[i+4: j])
177 # Internal -- scan past the internal subset in a <!DOCTYPE declaration,
182 j = i
183 while j < n:
184 c = rawdata[j]
186 s = rawdata[j:j+2]
189 return -1
191 self.updatepos(declstartpos, j + 1)
195 if (j + 2) == n:
197 return -1
198 if (j + 4) > n:
200 return -1
201 if rawdata[j:j+4] == "<!--":
202 j = self.parse_comment(j, report=0)
203 if j < 0:
204 return j
206 name, j = self._scan_name(j + 2, declstartpos)
207 if j == -1:
208 return -1
210 self.updatepos(declstartpos, j + 2)
216 j = meth(j, declstartpos)
217 if j < 0:
218 return j
221 if (j + 1) == n:
223 return -1
224 s, j = self._scan_name(j + 1, declstartpos)
225 if j < 0:
226 return j
227 if rawdata[j] == ";":
228 j = j + 1
230 j = j + 1
231 while j < n and rawdata[j].isspace():
232 j = j + 1
233 if j < n:
234 if rawdata[j] == ">":
235 return j
236 self.updatepos(declstartpos, j)
239 return -1
241 j = j + 1
243 self.updatepos(declstartpos, j)
246 return -1
248 # Internal -- scan past <!ELEMENT declarations
250 name, j = self._scan_name(i, declstartpos)
251 if j == -1:
252 return -1
255 if '>' in rawdata[j:]:
256 return rawdata.find(">", j) + 1
257 return -1
259 # Internal -- scan past <!ATTLIST declarations
262 name, j = self._scan_name(i, declstartpos)
263 c = rawdata[j:j+1]
265 return -1
267 return j + 1
271 name, j = self._scan_name(j, declstartpos)
272 if j < 0:
273 return j
274 c = rawdata[j:j+1]
276 return -1
279 if ")" in rawdata[j:]:
280 j = rawdata.find(")", j) + 1
282 return -1
283 while rawdata[j:j+1].isspace():
284 j = j + 1
285 if not rawdata[j:]:
287 return -1
289 name, j = self._scan_name(j, declstartpos)
290 c = rawdata[j:j+1]
292 return -1
294 m = _declstringlit_match(rawdata, j)
296 j = m.end()
298 return -1
299 c = rawdata[j:j+1]
301 return -1
303 if rawdata[j:] == "#":
305 return -1
306 name, j = self._scan_name(j + 1, declstartpos)
307 if j < 0:
308 return j
309 c = rawdata[j:j+1]
311 return -1
314 return j + 1
316 # Internal -- scan past <!NOTATION declarations
318 name, j = self._scan_name(i, declstartpos)
319 if j < 0:
320 return j
323 c = rawdata[j:j+1]
326 return -1
328 return j + 1
330 m = _declstringlit_match(rawdata, j)
332 return -1
333 j = m.end()
335 name, j = self._scan_name(j, declstartpos)
336 if j < 0:
337 return j
339 # Internal -- scan past <!ENTITY declarations
343 j = i + 1
345 c = rawdata[j:j+1]
347 return -1
349 j = j + 1
353 j = i
354 name, j = self._scan_name(j, declstartpos)
355 if j < 0:
356 return j
358 c = self.rawdata[j:j+1]
360 return -1
362 m = _declstringlit_match(rawdata, j)
364 j = m.end()
366 return -1 # incomplete
368 return j + 1
370 name, j = self._scan_name(j, declstartpos)
371 if j < 0:
372 return j
374 # Internal -- scan a name token and the new position and the token, or
375 # return -1 if we've reached the end of the buffer.
380 return None, -1
386 return None, -1 # end of buffer
394 # To be overridden -- handlers for unknown objects