Ejemplo n.º 1
0
    def __init__(self, handler):
        Parser.__init__(self, handler)

        ## ul, li 列表处理
        self.addRule(ListRule())
        self.addRule(ListItemRule())

        ## 文章标题处理
        self.addRule(TitleRule())

        ## 一级标题
        self.addRule(Header1Rule())

        ## 普通段落处理
        self.addRule(ParagraphRule())

        ###############################################################
        ##                        特殊标记处理
        ###############################################################
        
        ## 斜体
        self.addFilter(r'\*(.+?)\*', 'emphasis')
        ## url
        self.addFilter(r'(http://[\.a-zA-Z/]+)', 'url')
        ## email
        self.addFilter(r'([\.a-zA-Z]+@[\.a-zA-Z]+[a-zA-z]+)', 'mail')
Ejemplo n.º 2
0
    def __init__(self, it, reporter):
        self.b = ['\n{']
        self.comments = False
        self.inSimutaneous = False

        # keep track of list indexing, for commas
        self.first = True
        Parser.__init__(self, it, reporter)
Ejemplo n.º 3
0
 def __init__(self):
     """ Load the shared BIN grammar if not already there, then initialize
         the Parser parent class """
     g = BIN_Parser._grammar
     if g is None:
         g = Grammar()
         g.read("Reynir.grammar")
         BIN_Parser._grammar = g
     Parser.__init__(self, g)
Ejemplo n.º 4
0
    def __init__(self, handler):
        Parser.__init__(self, handler)
        self.addRule(ListRule())
        self.addRule(ListItemRule())
        self.addRule(TitleRule())
        self.addRule(HeadingRule())
        self.addRule(ParagraphRule())

        self.addFilter(r'\*(.+?)\*', 'emphasis')
        self.addFilter(r'(http://[\.a-zA-Z/]+)', 'url')
        self.addFilter(r'([\.a-zA-Z]+@[\.a-zA-Z]+[a-zA-Z]+)', 'mail')
Ejemplo n.º 5
0
 def __init__(self,
              start_sym,
              grammar,
              scanner,
              dictionaries=None,
              debug=False):
     Parser.__init__(self, start_sym, grammar, scanner.tokens.keys())
     self.scanner = scanner
     self.dictionaries = dictionaries or {}
     self.results = []
     self.debug_mode = debug
Ejemplo n.º 6
0
 def __init__(self, verbose, repository_tag, repository_chunk, airr_map, repository):
     # Initialize the base class
     Parser.__init__(self, verbose, repository_tag, repository_chunk, airr_map, repository)
     # Each rearrangement parser is used to parse data from an annotation tool.
     # This keeps track of the annotation tool being used and is used
     # to insert annotation tool information into the repository.
     # Subclasses that process data files from a specific type of 
     # annotation tool should set this value.
     # This is only used for rearrangement files.
     self.annotation_tool = ""
     # Each file has fields in it. This variable holds the mapping column
     # from the AIRR Mapping file to use for this parser. Again, subclasses
     # for specific file types should explicitly set this to the correct
     # column.
     self.file_mapping = ""
Ejemplo n.º 7
0
 def __init__(self, module_properties):
   Parser.__init__(self)
   self._m = 0
   if module_properties.has_key('hash_dimensions'):
       self._m = int(module_properties['hash_dimensions'])
   self._regular_features = 4
Ejemplo n.º 8
0
 def __init__(self, it, reporter):
     self.b = []
     self.tree = Score()
     Parser.__init__(self, it, reporter)
Ejemplo n.º 9
0
 def __init__(self):
     Parser.__init__(self)
     self.last_chunk_name = None
Ejemplo n.º 10
0
 def __init__(self):
     self.site = 'lashou'
     Parser.__init__(self)
Ejemplo n.º 11
0
 def __init__(self, logger):
     Parser.__init__(self, logger)
Ejemplo n.º 12
0
 def __init__(self):
     self.site = 'nuomi'
     Parser.__init__(self)
Ejemplo n.º 13
0
 def __init__(self, tokens):
   Parser.__init__(self, [t for t in tokens if t.type is not WSPACE])
Ejemplo n.º 14
0
 def __init__(self, input_lexer, k):
     Parser.__init__(self, input_lexer, k)
Ejemplo n.º 15
0
 def __init__(self, input_file):
     # call the base class constructor
     Parser.__init__(self, input_file)
     logging.debug("Yml parser initialized")
Ejemplo n.º 16
0
 def __init__(self, logger=None):
     Parser.__init__(self, logger)
Ejemplo n.º 17
0
 def __init__(self):
     self.site = 'meituan'
     Parser.__init__(self)
Ejemplo n.º 18
0
 def __init__(self, start_sym, grammar, scanner, dictionaries=None, debug=False):
     Parser.__init__(self, start_sym, grammar, scanner.tokens.keys())
     self.scanner = scanner
     self.dictionaries = dictionaries or {}
     self.results = []
     self.debug_mode = debug
Ejemplo n.º 19
0
 def __init__(self,fileName):
     Parser.__init__(self,fileName)
Ejemplo n.º 20
0
 def __init__(self):
     Parser.__init__(self, logger=Logger())
Ejemplo n.º 21
0
 def __init__(self, settings, language):
     Parser.__init__(self, settings, language)
     self.meaning = 0
Ejemplo n.º 22
0
Archivo: moc.py Proyecto: phuang/rob
 def __init__(self):
   Parser.__init__(self)
Ejemplo n.º 23
0
 def __init__(self, tokens):
     Parser.__init__(self, [t for t in tokens if t.type is not WSPACE])
Ejemplo n.º 24
0
 def __init__(self, settings, language):
     Parser.__init__(self, settings, language)
Ejemplo n.º 25
0
 def __init__(self, rules):
     Parser.__init__(self, rules)
Ejemplo n.º 26
0
 def __init__(self, _ext):
     Parser.__init__(self)
     self.ext = _ext
     self.links = []
 def __init__(self, verbose, repository_tag, repository_chunk, airr_map, repository):
     Parser.__init__(self, verbose, repository_tag, repository_chunk, airr_map, repository)
Ejemplo n.º 28
0
 def __init__(self, fileName):
     Parser.__init__(self, fileName)
Ejemplo n.º 29
0
	def __init__(self, logger=None):
		Parser.__init__(self, logger)
		self.laparams.char_margin = 1.0
		self.first_section = True
Ejemplo n.º 30
0
 def __init__(self):
     self.site = 'dianping'
     Parser.__init__(self)
 def __init__(self, input_lexer):
     Parser.__init__(self, input_lexer)
     self.list_memo = {}