# -*- coding: utf-8 -*-
# module pyparsing.py
#
# Copyright (c) 2003-2019 Paul T. McGuire
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__doc__ = \
"""
pyparsing module - Classes and methods to define and execute parsing grammars
=============================================================================
The pyparsing module is an alternative approach to creating and
executing simple grammars, vs. the traditional lex/yacc approach, or the
use of regular expressions. With pyparsing, you don't need to learn
a new syntax for defining grammars or matching expressions - the parsing
module provides a library of classes that you use to construct the
grammar directly in Python.
Here is a program to parse "Hello, World!" (or any greeting of the form
``"<salutation>, <addressee>!"``), built up using :class:`Word`,
:class:`Literal`, and :class:`And` elements
(the :class:`'+'<ParserElement.__add__>` operators create :class:`And` expressions,
and the strings are auto-converted to :class:`Literal` expressions)::
from pip._vendor.pyparsing import Word, alphas
# define grammar of a greeting
greet = Word(alphas) + "," + Word(alphas) + "!"
hello = "Hello, World!"
print (hello, "->", greet.parseString(hello))
The program outputs the following::
Hello, World! -> ['Hello', ',', 'World', '!']
The Python representation of the grammar is quite readable, owing to the
self-explanatory class names, and the use of '+', '|' and '^' operators.
The :class:`ParseResults` object returned from
:class:`ParserElement.parseString` can be
accessed as a nested list, a dictionary, or an object with named
attributes.
The pyparsing module handles some of the problems that are typically
vexing when writing text parsers:
- extra or missing whitespace (the above program will also handle
"Hello,World!", "Hello , World !", etc.)
- quoted strings
- embedded comments
Getting Started -
-----------------
Visit the classes :class:`ParserElement` and :class:`ParseResults` to
see the base classes that most other pyparsing
classes inherit from. Use the docstrings for examples of how to:
- construct literal match expressions from :class:`Literal` and
:class:`CaselessLiteral` classes
- construct character word-group expressions using the :class:`Word`
class
- see how to create repetitive expressions using :class:`ZeroOrMore`
and :class:`OneOrMore` classes
- use :class:`'+'<And>`, :class:`'|'<MatchFirst>`, :class:`'^'<Or>`,
and :class:`'&'<Each>` operators to combine simple expressions into
more complex ones
- associate names with your parsed results using
:class:`ParserElement.setResultsName`
- access the parsed data, which is returned as a :class:`ParseResults`
object
- find some helpful expression short-cuts like :class:`delimitedList`
and :class:`oneOf`
- find more useful common expressions in the :class:`pyparsing_common`
namespace class
"""
__version__ = "2.4.6"
__versionTime__ = "24 Dec 2019 04:27 UTC"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
from weakref import ref as wkref
import copy
import sys
import warnings
import re
import sre_constants
import collections
import pprint
import traceback
import types
from datetime import datetime
from operator import itemgetter
import itertools
from functools import wraps
from contextlib import contextmanager
try:
# Python 3
from itertools import filterfalse
except ImportError:
from itertools import ifilterfalse as filterfalse
try:
from _thread import RLock
except ImportError:
from threading import RLock
try:
# Python 3
from collections.abc import Iterable
from collections.abc import MutableMapping, Mapping
except ImportError:
# Python 2.7
from collections import Iterable
from collections import MutableMapping, Mapping
try:
from collections import OrderedDict as _OrderedDict
except ImportError:
try:
from ordereddict import OrderedDict as _OrderedDict
except ImportError:
_OrderedDict = None
try:
from types import SimpleNamespace
except ImportError:
class SimpleNamespace: pass
# version compatibility configuration
__compat__ = SimpleNamespace()
__compat__.__doc__ = """
A cross-version compatibility configuration for pyparsing features that will be
released in a future version. By setting values in this configuration to True,
those features can be enabled in prior versions for compatibility development
and testing.
- collect_all_And_tokens - flag to enable fix for Issue #63 that fixes erroneous grouping
of results names when an And expression is nested within an Or or MatchFirst; set to
True to enable bugfix released in pyparsing 2.3.0, or False to preserve
pre-2.3.0 handling of named results
"""
__compat__.collect_all_And_tokens = True
__diag__ = SimpleNamespace()
__diag__.__doc__ = """
Diagnostic configuration (all default to False)
- warn_multiple_tokens_in_named_alternation - flag to enable warnings when a results
name is defined on a MatchFirst or Or expression with one or more And subexpressions
(only warns if __compat__.collect_all_And_tokens is False)
- warn_ungrouped_named_tokens_in_collection - flag to enable warnings when a results
name is defined on a containing expression with ungrouped subexpressions that also
have results names
- warn_name_set_on_empty_Forward - flag to enable warnings whan a Forward is defined
with a results name, but has no contents defined
- warn_on_multiple_string_args_to_oneof - flag to enable warnings whan oneOf is
incorrectly called with multiple str arguments
- enable_debug_on_named_expressions - flag to auto-enable debug on all subsequent
calls to ParserElement.setName()
"""
__diag__.warn_multiple_tokens_in_named_alternation = False
__diag__.warn_ungrouped_named_tokens_in_collection = False
__diag__.warn_name_set_on_empty_Forward = False
__diag__.warn_on_multiple_string_args_to_oneof = False
__diag__.enable_debug_on_named_expressions = False
__diag__._all_names = [nm for nm in vars(__diag__) if nm.startswith("enable_") or nm.startswith("warn_")]
def _enable_all_warnings():
__diag__.warn_multiple_tokens_in_named_alternation = True
__diag__.warn_ungrouped_named_tokens_in_collection = True
__diag__.warn_name_set_on_empty_Forward = True
__diag__.warn_on_multiple_string_args_to_oneof = True
__diag__.enable_all_warnings = _enable_all_warnings
__all__ = ['__version__', '__versionTime__', '__author__', '__compat__', '__diag__',
'And', 'CaselessKeyword', 'CaselessLiteral', 'CharsNotIn', 'Combine', 'Dict', 'Each', 'Empty',
'FollowedBy', 'Forward', 'GoToColumn', 'Group', 'Keyword', 'LineEnd', 'LineStart', 'Literal',
'PrecededBy', 'MatchFirst', 'NoMatch', 'NotAny', 'OneOrMore', 'OnlyOnce', 'Optional', 'Or',
'ParseBaseException', 'ParseElementEnhance', 'Pars
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【目标受众】: 本项目适合IT相关专业各种计算机技术的源代码和项目资料,如计科、人工智能、通信工程、自动化和电子信息等的在校学生、老师或者企业员工下载使用。 也适合小白学习进阶,可以用作比赛项目、可以进行项目复刻去参加同赛道比赛。 【资源内容】: 源码与竞赛资料:教育部认可的大学生竞赛备赛资料代码、源码、竞赛总结。 功能与质量保证:这个资源库是一个宝贵的学习平台,有助于他们深入了解计算机技术的原理和应用。这些源码经过测试和验证,可以直接运行,方便学生快速上手并开始实践。 【应用场景】: 竞赛准备:适用于各种教育部认可的竞赛,如全国电子设计大赛、全国大学生智能汽车竞赛等,他们可以借助这些资料了解竞赛的规则、要求和技巧。 学习与项目开发:可以用作毕设、课设、作业和竞赛项目的开发基础,可以使用这些源码作为项目开发的基础,快速构建出具有竞争力的作品。 【互动与交流】: 资料鼓励下载和使用这些资源,并欢迎学习者进行沟通交流、互相学习、共同进步。这种互动式的学习方式有助于形成良好的学习氛围,促进知识的共享和传播,为计算机相关专业的学习者提供了一个全面的学习和发展平台。
资源推荐
资源详情
资源评论
收起资源包目录
竞赛资料源码-第十三届全国大学生信息安全竞赛.zip (2001个子文件)
config-3.6m-x86_64-linux-gnu 47B
distutils.cfg 228B
bootstrap.css 118KB
bootstrap.min.css 111KB
style.css 107KB
jquery-ui.css 32KB
style2.css 32KB
jquery.idealforms.min.css 28KB
font-awesome.css 22KB
responsive.css 18KB
select2.css 17KB
jquery-ui-1.9.2.custom.css 17KB
base.css 16KB
select2.min.css 15KB
jquery-ui-1.9.2.custom.min.css 15KB
widgets.css 10KB
clndr.css 10KB
normalize.css 9KB
style.css 9KB
forms.css 8KB
autocomplete.css 8KB
owl.carousel.css 8KB
icon-font.min.css 7KB
main.css 7KB
flexslider.css 7KB
jquery.grid.css 6KB
zTreeStyle.css 6KB
nav.css 6KB
changelists.css 6KB
comboboxmenu.css 4KB
login.css 4KB
datepicker.css 4KB
rtl.css 4KB
datepicker.css 4KB
buttonicon.css 3KB
main._bak.css 3KB
jquery.dialog.css 3KB
demo.css 3KB
image(│σ═╗╩▒╡─╬─╝■▒╕╖▌2014-04-30 19-06-41).css 3KB
image.css 3KB
index.css 3KB
video(│σ═╗╩▒╡─╬─╝■▒╕╖▌2014-04-30 19-06-40).css 3KB
video.css 3KB
graph.css 2KB
login.css 2KB
content.css 2KB
emotion.css 2KB
emotion(│σ═╗╩▒╡─╬─╝■▒╕╖▌2014-04-30 19-06-40).css 2KB
table.css 2KB
fabochart.css 2KB
responsive_rtl.css 2KB
dialog(│σ═╗╩▒╡─╬─╝■▒╕╖▌2014-04-30 19-06-39).css 2KB
dialog.css 2KB
base.css 1KB
login.css 1KB
combobox.css 1KB
combobox(│σ═╗╩▒╡─╬─╝■▒╕╖▌2014-04-30 19-06-39).css 1KB
editor(│σ═╗╩▒╡─╬─╝■▒╕╖▌2014-04-30 19-06-38).css 1KB
editor.css 1KB
colorpicker.css 1KB
colorpicker(│σ═╗╩▒╡─╬─╝■▒╕╖▌2014-04-30 19-06-38).css 1KB
tab.css 976B
tab(│σ═╗╩▒╡─╬─╝■▒╕╖▌2014-04-30 19-06-38).css 976B
splitbutton(│σ═╗╩▒╡─╬─╝■▒╕╖▌2014-04-30 19-06-37).css 931B
splitbutton.css 931B
atlas.css 902B
formula(│σ═╗╩▒╡─╬─╝■▒╕╖▌2014-04-30 19-06-37).css 838B
formula.css 838B
button(│σ═╗╩▒╡─╬─╝■▒╕╖▌2014-04-30 19-06-37).css 781B
button.css 781B
tooltip.css 758B
tooltip(│σ═╗╩▒╡─╬─╝■▒╕╖▌2014-04-30 19-06-37).css 758B
ol3.css 657B
form.css 542B
popup.css 457B
fonts.css 423B
dashboard.css 412B
dialogsize.css 393B
umeditor.css 312B
separator.css 304B
WdatePicker.css 192B
WdatePicker.css 158B
.DS_Store 6KB
encodings 28B
gui-64.exe 74KB
cli-64.exe 73KB
cli-32.exe 64KB
cli.exe 64KB
gui-32.exe 64KB
gui.exe 64KB
statistics.html 40KB
technical_500.html 17KB
default_urlconf.html 16KB
index.html 13KB
table.html 9KB
main.html 9KB
search.html 9KB
nav.html 8KB
formula.html 7KB
map.html 6KB
共 2001 条
- 1
- 2
- 3
- 4
- 5
- 6
- 21
资源评论
妄北y
- 粉丝: 1w+
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功