Lines Matching +full:- +full:j
11 _declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*').match
13 _commentclose = re.compile(r'--\s*>')
16 # An analysis of the MS-Word extensions is available at
45 # Internal -- update line number and offset. This should be
46 # called for each piece of data exactly once, in order -- in other
49 def updatepos(self, i, j): argument
50 if i >= j:
51 return j
53 nlines = rawdata.count("\n", i, j)
56 pos = rawdata.rindex("\n", i, j) # Should not fail
57 self.offset = j-(pos+1)
59 self.offset = self.offset + j-i
60 return j
64 # Internal -- parse declaration (for use by subclasses).
71 # --comment--
77 j = i + 2
78 assert rawdata[i:j] == "<!", "unexpected call to parse_declaration"
79 if rawdata[j:j+1] == ">":
81 return j + 1
82 if rawdata[j:j+1] in ("-", ""):
85 return -1
88 if rawdata[j:j+2] == '--': #comment
89 # Locate --.*-- as the body of the comment
91 elif rawdata[j] == '[': #marked section
98 decltype, j = self._scan_name(j, i)
99 if j < 0:
100 return j
103 while j < n:
104 c = rawdata[j]
107 data = rawdata[i+2:j]
116 return j + 1
118 m = _declstringlit_match(rawdata, j)
120 return -1 # incomplete
121 j = m.end()
123 name, j = self._scan_name(j, i)
125 j = j + 1
129 j = self._parse_doctype_subset(j + 1, i)
140 "unexpected %r char in declaration" % rawdata[j])
141 if j < 0:
142 return j
143 return -1 # incomplete
145 # Internal -- parse a marked section
146 # Override this to handle MS-word extension syntax <![if word]>content<![endif]>
150 sectName, j = self._scan_name( i+3, i )
151 if j < 0:
152 return j
160 self.error('unknown status keyword %r in marked section' % rawdata[i+3:j])
162 return -1
164 j = match.start(0)
165 self.unknown_decl(rawdata[i+3: j])
168 # Internal -- parse comment, return length or -1 if not terminated
171 if rawdata[i:i+4] != '<!--':
175 return -1
177 j = match.start(0)
178 self.handle_comment(rawdata[i+4: j])
181 # Internal -- scan past the internal subset in a <!DOCTYPE declaration,
186 j = i
187 while j < n:
188 c = rawdata[j]
190 s = rawdata[j:j+2]
193 return -1
195 self.updatepos(declstartpos, j + 1)
197 if (j + 2) == n:
199 return -1
200 if (j + 4) > n:
202 return -1
203 if rawdata[j:j+4] == "<!--":
204 j = self.parse_comment(j, report=0)
205 if j < 0:
206 return j
208 name, j = self._scan_name(j + 2, declstartpos)
209 if j == -1:
210 return -1
212 self.updatepos(declstartpos, j + 2)
217 j = meth(j, declstartpos)
218 if j < 0:
219 return j
222 if (j + 1) == n:
224 return -1
225 s, j = self._scan_name(j + 1, declstartpos)
226 if j < 0:
227 return j
228 if rawdata[j] == ";":
229 j = j + 1
231 j = j + 1
232 while j < n and rawdata[j].isspace():
233 j = j + 1
234 if j < n:
235 if rawdata[j] == ">":
236 return j
237 self.updatepos(declstartpos, j)
240 return -1
242 j = j + 1
244 self.updatepos(declstartpos, j)
247 return -1
249 # Internal -- scan past <!ELEMENT declarations
251 name, j = self._scan_name(i, declstartpos)
252 if j == -1:
253 return -1
256 if '>' in rawdata[j:]:
257 return rawdata.find(">", j) + 1
258 return -1
260 # Internal -- scan past <!ATTLIST declarations
263 name, j = self._scan_name(i, declstartpos)
264 c = rawdata[j:j+1]
266 return -1
268 return j + 1
272 name, j = self._scan_name(j, declstartpos)
273 if j < 0:
274 return j
275 c = rawdata[j:j+1]
277 return -1
280 if ")" in rawdata[j:]:
281 j = rawdata.find(")", j) + 1
283 return -1
284 while rawdata[j:j+1].isspace():
285 j = j + 1
286 if not rawdata[j:]:
288 return -1
290 name, j = self._scan_name(j, declstartpos)
291 c = rawdata[j:j+1]
293 return -1
295 m = _declstringlit_match(rawdata, j)
297 j = m.end()
299 return -1
300 c = rawdata[j:j+1]
302 return -1
304 if rawdata[j:] == "#":
306 return -1
307 name, j = self._scan_name(j + 1, declstartpos)
308 if j < 0:
309 return j
310 c = rawdata[j:j+1]
312 return -1
315 return j + 1
317 # Internal -- scan past <!NOTATION declarations
319 name, j = self._scan_name(i, declstartpos)
320 if j < 0:
321 return j
324 c = rawdata[j:j+1]
327 return -1
329 return j + 1
331 m = _declstringlit_match(rawdata, j)
333 return -1
334 j = m.end()
336 name, j = self._scan_name(j, declstartpos)
337 if j < 0:
338 return j
340 # Internal -- scan past <!ENTITY declarations
344 j = i + 1
346 c = rawdata[j:j+1]
348 return -1
350 j = j + 1
354 j = i
355 name, j = self._scan_name(j, declstartpos)
356 if j < 0:
357 return j
359 c = self.rawdata[j:j+1]
361 return -1
363 m = _declstringlit_match(rawdata, j)
365 j = m.end()
367 return -1 # incomplete
369 return j + 1
371 name, j = self._scan_name(j, declstartpos)
372 if j < 0:
373 return j
375 # Internal -- scan a name token and the new position and the token, or
376 # return -1 if we've reached the end of the buffer.
381 return None, -1
387 return None, -1 # end of buffer
394 # To be overridden -- handlers for unknown objects