当前位置: 首页>>代码示例>>Python>>正文


Python yacc.NullLogger方法代码示例

本文整理汇总了Python中ply.yacc.NullLogger方法的典型用法代码示例。如果您正苦于以下问题:Python yacc.NullLogger方法的具体用法?Python yacc.NullLogger怎么用?Python yacc.NullLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ply.yacc的用法示例。


在下文中一共展示了yacc.NullLogger方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from ply import yacc [as 别名]
# 或者: from ply.yacc import NullLogger [as 别名]
def __init__(self, **kwargs):
    if 'tokens' in kwargs.keys(): # MANDATORY
      self.tokens = kwargs['tokens']
    kwargs.pop('tokens', None)

    # debugging and logging http://www.dabeaz.com/ply/ply.html#ply_nn44 
    #self.parser = yacc.yacc(module=self, start='step', errorlog=yacc.NullLogger(), debug = True, debugfile='debug_file', **kwargs) 
    self.parser = yacc.yacc(module=self, start='step', errorlog=yacc.NullLogger(), debug = False, **kwargs) 

    # https://github.com/dabeaz/ply/blob/master/ply/yacc.py
    # debug yaccdebug   = True        # Debugging mode.  If set, yacc generates a
                               # a 'parser.out' file in the current directory

# """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
#  MAIN
# """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""


# example use: 
开发者ID:nicolashernandez,项目名称:PyRATA,代码行数:21,代码来源:syntactic_step_parser.py

示例2: __init__

# 需要导入模块: from ply import yacc [as 别名]
# 或者: from ply.yacc import NullLogger [as 别名]
def __init__(self, outputdir='', lexer=None):
        Tokenizer.__init__(self, outputdir, lexer)
        self.parser = yacc.yacc(module=self,
                                outputdir=outputdir,
                                tabmodule='webidlyacc',
                                errorlog=yacc.NullLogger(),
                                picklefile='WebIDLGrammar.pkl')
        self._globalScope = IDLScope(BuiltinLocation("<Global Scope>"), None, None)
        self._installBuiltins(self._globalScope)
        self._productions = []

        self._filename = "<builtin>"
        self.lexer.input(Parser._builtins)
        self._filename = None

        self.parser.parse(lexer=self.lexer,tracking=True) 
开发者ID:Dador,项目名称:JavascriptSubtitlesOctopus,代码行数:18,代码来源:WebIDL.py

示例3: __init__

# 需要导入模块: from ply import yacc [as 别名]
# 或者: from ply.yacc import NullLogger [as 别名]
def __init__(self, debug=0, log=yacc.NullLogger()):
        self.parser = yacc.yacc(module=self, tabmodule='pyoracc.atf.parsetab',
                                debug=debug, debuglog=log) 
开发者ID:oracc,项目名称:pyoracc,代码行数:5,代码来源:atfyacc.py

示例4: build

# 需要导入模块: from ply import yacc [as 别名]
# 或者: from ply.yacc import NullLogger [as 别名]
def build(self, **kwargs):
        self.parser = yacc.yacc(
            module=self, debug=False, write_tables=False, errorlog=yacc.NullLogger(), **kwargs)
        self.lexer = HealthLexer().build()
        return self.parser 
开发者ID:aerospike,项目名称:aerospike-admin,代码行数:7,代码来源:parser.py

示例5: __init__

# 需要导入模块: from ply import yacc [as 别名]
# 或者: from ply.yacc import NullLogger [as 别名]
def __init__(self, **kwargs):
        if kwargs.pop('silent', False):
            kwargs['errorlog'] = yacc.NullLogger()

        kwargs.setdefault('debug', False)
        kwargs.setdefault('write_tables', False)
        self._parser = yacc.yacc(module=self, **kwargs)
        self._lexer = Lexer() 
开发者ID:thriftrw,项目名称:thriftrw-python,代码行数:10,代码来源:parser.py

示例6: __init__

# 需要导入模块: from ply import yacc [as 别名]
# 或者: from ply.yacc import NullLogger [as 别名]
def __init__(self, startSym='mibFile', tempdir=''):
        if tempdir:
            tempdir = os.path.join(tempdir, startSym)
            try:
                os.makedirs(tempdir)
            except OSError:
                if sys.exc_info()[1].errno != 17:
                    raise error.PySmiError('Failed to create cache directory %s: %s' % (tempdir, sys.exc_info()[1]))

        self.lexer = self.defaultLexer(tempdir=tempdir)

        # tokens are required for parser
        self.tokens = self.lexer.tokens

        if debug.logger & debug.flagParser:
            logger = debug.logger.getCurrentLogger()
        else:
            logger = yacc.NullLogger()

        if debug.logger & debug.flagGrammar:
            debuglogger = debug.logger.getCurrentLogger()
        else:
            debuglogger = None

        self.parser = yacc.yacc(module=self,
                                start=startSym,
                                write_tables=bool(tempdir),
                                debug=False,
                                outputdir=tempdir,
                                debuglog=debuglogger,
                                errorlog=logger) 
开发者ID:scalyr,项目名称:scalyr-agent-2,代码行数:33,代码来源:smi.py

示例7: _yacc

# 需要导入模块: from ply import yacc [as 别名]
# 或者: from ply.yacc import NullLogger [as 别名]
def _yacc(verbose=False, out_dir=None):
    """
    Return YACC parser object for the MOF compiler.

    Parameters:

      verbose (bool): Print messages while creating the parser object.

      out_dir (string): Path name of the directory in which the YACC table
        module source file (_mofparsetab.py) for the MOF compiler will be
        generated. If None, that file will not be generated.

    Returns:

      yacc.Parser: YACC parser object for the MOF compiler.
    """

    # The write_tables argument controls whether the YACC parser writes
    # the YACC table module file.
    write_tables = (out_dir is not None)

    # In yacc(), the 'debug' parameter controls the main error
    # messages to the 'errorlog' in addition to the debug messages
    # to the 'debuglog'. Because we want to see the error messages,
    # we enable debug but set the debuglog to the NullLogger.
    # To enable debug logging, set debuglog to some other logger
    # (ex. PlyLogger(sys.stdout) to generate log output.
    return yacc.yacc(optimize=_optimize,
                     tabmodule=_tabmodule,
                     outputdir=out_dir,
                     write_tables=write_tables,
                     debug=verbose,
                     debuglog=yacc.NullLogger(),
                     errorlog=yacc.PlyLogger(sys.stdout) if verbose
                     else yacc.NullLogger()) 
开发者ID:pywbem,项目名称:pywbem,代码行数:37,代码来源:_mof_compiler.py

示例8: _lex

# 需要导入模块: from ply import yacc [as 别名]
# 或者: from ply.yacc import NullLogger [as 别名]
def _lex(verbose=False, out_dir=None):
    """
    Return LEX analyzer object for the MOF Compiler.

    Parameters:

      verbose (bool): Print messages while creating the parser object.

      out_dir (string): Path name of the directory in which the LEX table
        module source file (_moflextab.py) for the MOF compiler will be
        generated. If None, that file will not be generated.

    Returns:

      lex.Lexer: LEX analyzer object for the MOF compiler.
    """

    # Unfortunately, lex() does not support a write_tables argument. It
    # always tries to write the tables if optimize=True, so we supply a dummy
    # output directory. Always setting optimize=False is also not a good
    # solution because that causes the input table not to be used.
    if out_dir is None:
        out_dir = tempfile.gettempdir()

    # To debug lex you may set debug=True and enable the debuglog statement.
    # or other logger definition.
    return lex.lex(optimize=_optimize,
                   lextab=_lextab,
                   outputdir=out_dir,
                   debug=False,
                   # debuglog = lex.PlyLogger(sys.stdout),
                   errorlog=yacc.PlyLogger(sys.stdout) if verbose
                   else yacc.NullLogger()) 
开发者ID:pywbem,项目名称:pywbem,代码行数:35,代码来源:_mof_compiler.py


注:本文中的ply.yacc.NullLogger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。