示例#1
0
文件: txt2html.py 项目: wwq0327/note
    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')
示例#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)
示例#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)
示例#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')
示例#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
示例#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 = ""
示例#7
0
文件: kdd.py 项目: nachocano/asml
 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
示例#8
0
 def __init__(self, it, reporter):
     self.b = []
     self.tree = Score()
     Parser.__init__(self, it, reporter)
示例#9
0
文件: tangle.py 项目: wware/autosci
 def __init__(self):
     Parser.__init__(self)
     self.last_chunk_name = None
示例#10
0
 def __init__(self):
     self.site = 'lashou'
     Parser.__init__(self)
示例#11
0
 def __init__(self, logger):
     Parser.__init__(self, logger)
示例#12
0
 def __init__(self):
     self.site = 'nuomi'
     Parser.__init__(self)
示例#13
0
 def __init__(self, tokens):
   Parser.__init__(self, [t for t in tokens if t.type is not WSPACE])
示例#14
0
 def __init__(self, input_lexer, k):
     Parser.__init__(self, input_lexer, k)
示例#15
0
 def __init__(self, input_file):
     # call the base class constructor
     Parser.__init__(self, input_file)
     logging.debug("Yml parser initialized")
示例#16
0
文件: cleanup.py 项目: Sriee/Snapshot
 def __init__(self, logger=None):
     Parser.__init__(self, logger)
示例#17
0
 def __init__(self):
     self.site = 'meituan'
     Parser.__init__(self)
示例#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
 def __init__(self,fileName):
     Parser.__init__(self,fileName)
示例#20
0
 def __init__(self):
     Parser.__init__(self, logger=Logger())
示例#21
0
 def __init__(self, settings, language):
     Parser.__init__(self, settings, language)
     self.meaning = 0
示例#22
0
文件: moc.py 项目: phuang/rob
 def __init__(self):
   Parser.__init__(self)
示例#23
0
 def __init__(self, tokens):
     Parser.__init__(self, [t for t in tokens if t.type is not WSPACE])
示例#24
0
 def __init__(self, settings, language):
     Parser.__init__(self, settings, language)
示例#25
0
 def __init__(self, rules):
     Parser.__init__(self, rules)
示例#26
0
文件: weave.py 项目: wware/autosci
 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)
示例#28
0
 def __init__(self, fileName):
     Parser.__init__(self, fileName)
示例#29
0
	def __init__(self, logger=None):
		Parser.__init__(self, logger)
		self.laparams.char_margin = 1.0
		self.first_section = True
示例#30
0
 def __init__(self):
     self.site = 'dianping'
     Parser.__init__(self)
 def __init__(self, input_lexer):
     Parser.__init__(self, input_lexer)
     self.list_memo = {}