GNUnet 0.21.1
typescriptdomain.LinkFilter Class Reference
Inheritance diagram for typescriptdomain.LinkFilter:
[legend]
Collaboration diagram for typescriptdomain.LinkFilter:
[legend]

Public Member Functions

def __init__ (self, app, **options)
 
def filter (self, lexer, stream)
 
def __init__ (self, app, **options)
 
def filter (self, lexer, stream)
 

Data Fields

 app
 

Private Member Functions

def _filter_one_literal (self, ttype, value)
 
def _filter_one_literal (self, ttype, value)
 

Detailed Description

Definition at line 307 of file typescriptdomain.py.

Constructor & Destructor Documentation

◆ __init__() [1/2]

def typescriptdomain.LinkFilter.__init__ (   self,
  app,
**  options 
)

Definition at line 308 of file typescriptdomain.py.

308 def __init__(self, app, **options):
309 self.app = app
310 Filter.__init__(self, **options)
311

◆ __init__() [2/2]

def typescriptdomain.LinkFilter.__init__ (   self,
  app,
**  options 
)

Definition at line 308 of file typescriptdomain.py.

308 def __init__(self, app, **options):
309 self.app = app
310 Filter.__init__(self, **options)
311

References typescriptdomain.LinkFilter.app.

Member Function Documentation

◆ _filter_one_literal() [1/2]

def typescriptdomain.LinkFilter._filter_one_literal (   self,
  ttype,
  value 
)
private

Definition at line 312 of file typescriptdomain.py.

312 def _filter_one_literal(self, ttype, value):
313 last = 0
314 for m in re.finditer(literal_reg, value):
315 pre = value[last : m.start()]
316 if pre:
317 yield ttype, pre
318 t = copy_token(ttype)
319 tok_setprop(t, "is_literal", True)
320 yield t, m.group(1)
321 last = m.end()
322 post = value[last:]
323 if post:
324 yield ttype, post
325
def tok_setprop(tok, key, value)

References typescriptdomain.copy_token(), and typescriptdomain.tok_setprop().

Referenced by typescriptdomain.LinkFilter.filter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filter() [1/2]

def typescriptdomain.LinkFilter.filter (   self,
  lexer,
  stream 
)

Definition at line 326 of file typescriptdomain.py.

326 def filter(self, lexer, stream):
327 for ttype, value in stream:
328 if ttype in Token.Keyword.Type:
329 t = copy_token(ttype)
330 tok_setprop(t, "xref", value.strip())
331 tok_setprop(t, "is_identifier", True)
332 yield t, value
333 elif ttype in Token.Comment:
334 last = 0
335 for m in re.finditer(link_reg, value):
336 pre = value[last : m.start()]
337 if pre:
338 yield from self._filter_one_literal(ttype, pre)
339 t = copy_token(ttype)
340 x1, x2 = m.groups()
341 x0 = m.group(0)
342 if x2 is None:
343 caption = x1.strip()
344 xref = x1.strip()
345 else:
346 caption = x1.strip()
347 xref = x2.strip()
348 tok_setprop(t, "xref", xref)
349 tok_setprop(t, "caption", caption)
350 if x0.endswith("_"):
351 tok_setprop(t, "trailing_underscore", True)
352 yield t, m.group(1)
353 last = m.end()
354 post = value[last:]
355 if post:
356 yield from self._filter_one_literal(ttype, post)
357 else:
358 yield ttype, value
359
360
static struct GNUNET_CONTAINER_BloomFilter * filter
Bloomfilter to quickly tell if we don't have the content.

References typescriptdomain.LinkFilter._filter_one_literal(), typescriptdomain.copy_token(), and typescriptdomain.tok_setprop().

Here is the call graph for this function:

◆ _filter_one_literal() [2/2]

def typescriptdomain.LinkFilter._filter_one_literal (   self,
  ttype,
  value 
)
private

Definition at line 312 of file typescriptdomain.py.

312 def _filter_one_literal(self, ttype, value):
313 last = 0
314 for m in re.finditer(literal_reg, value):
315 pre = value[last : m.start()]
316 if pre:
317 yield ttype, pre
318 t = copy_token(ttype)
319 tok_setprop(t, "is_literal", True)
320 yield t, m.group(1)
321 last = m.end()
322 post = value[last:]
323 if post:
324 yield ttype, post
325

References typescriptdomain.copy_token(), and typescriptdomain.tok_setprop().

Referenced by typescriptdomain.LinkFilter.filter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filter() [2/2]

def typescriptdomain.LinkFilter.filter (   self,
  lexer,
  stream 
)

Definition at line 326 of file typescriptdomain.py.

326 def filter(self, lexer, stream):
327 for ttype, value in stream:
328 if ttype in Token.Keyword.Type:
329 t = copy_token(ttype)
330 tok_setprop(t, "xref", value.strip())
331 tok_setprop(t, "is_identifier", True)
332 yield t, value
333 elif ttype in Token.Comment:
334 last = 0
335 for m in re.finditer(link_reg, value):
336 pre = value[last : m.start()]
337 if pre:
338 yield from self._filter_one_literal(ttype, pre)
339 t = copy_token(ttype)
340 x1, x2 = m.groups()
341 x0 = m.group(0)
342 if x2 is None:
343 caption = x1.strip()
344 xref = x1.strip()
345 else:
346 caption = x1.strip()
347 xref = x2.strip()
348 tok_setprop(t, "xref", xref)
349 tok_setprop(t, "caption", caption)
350 if x0.endswith("_"):
351 tok_setprop(t, "trailing_underscore", True)
352 yield t, m.group(1)
353 last = m.end()
354 post = value[last:]
355 if post:
356 yield from self._filter_one_literal(ttype, post)
357 else:
358 yield ttype, value
359
360

References typescriptdomain.LinkFilter._filter_one_literal(), typescriptdomain.copy_token(), and typescriptdomain.tok_setprop().

Here is the call graph for this function:

Field Documentation

◆ app

typescriptdomain.LinkFilter.app

Definition at line 309 of file typescriptdomain.py.

Referenced by typescriptdomain.LinkFilter.__init__().


The documentation for this class was generated from the following files: