1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
|
%global _empty_manifest_terminate_build 0
Name: python-parsing
Version: 2.0.0
Release: 1
Summary: A pure-Python module that implements an LR(1) parser generator, as well as CFSM and GLR parser drivers.
License: MIT
URL: http://www.canonware.com/Parsing/
Source0: https://mirrors.aliyun.com/pypi/web/packages/4f/4e/ed56edd1503cfd37882d67c09d00aa3c9ef7a249aabaf5840d85bda0d9ae/parsing-2.0.0.tar.gz
Requires: python3-flake8
Requires: python3-mypy
%description
The ``parsing`` module implements an LR(1) parser generator, as well as the
runtime support for using a generated parser, via the Lr and Glr parser
drivers. There is no special parser generator input file format, but the
parser generator still needs to know what classes/methods correspond to
various aspects of the parser. This information is specified via
docstrings, which the parser generator introspects in order to generate a
parser. Only one parser specification can be embedded in each module, but
it is possible to share modules between parser specifications so that, for
example, the same token definitions can be used by multiple parser
specifications.
The parsing tables are LR(1), but they are generated using a fast algorithm
that avoids creating duplicate states that result when using the generic
LR(1) algorithm. Creation time and table size are on par with the LALR(1)
algorithm. However, LALR(1) can create reduce/reduce conflicts that don't
exist in a true LR(1) parser. For more information on the algorithm, see::
A Practical General Method for Constructing LR(k) Parsers
David Pager
Acta Informatica 7, 249-268 (1977)
Parsing table generation requires non-trivial amounts of time for large
grammars, however it is still quite fast. Internal pickling support makes
it possible to cache the most recent version of the parsing table on disk,
and use the table if the current parser specification is still compatible
with the one that was used to generate the pickled parsing table. Since
the compatibility checking is quite fast, even for large grammars, this
removes the need to use the standard code generation method that is used
by most parser generators.
Parser specifications are encapsulated by the ``Spec`` class. Parser
instances use ``Spec`` instances, but are themselves based on separate
classes. This allows multiple parser instances to exist simultaneously,
without requiring multiple copies of the parsing tables. There are two
separate parser driver classes:
Lr:
Standard Characteristic Finite State Machine (CFSM) driver, based on
unambiguous LR(1) parsing tables. This driver is faster than the Glr
driver, but it cannot deal with all parsing tables that the Glr
driver can.
Glr:
Generalized LR driver, capable of tracking multiple parse trees
simultaneously, if the %split precedence is used to mark ambiguous
actions. This driver is closely based on Elkhound's design, which
is described in a technical report::
Elkhound: A Fast, Practical GLR Parser Generator
Scott McPeak
Report No. UCB/CSD-2-1214 (December 2002)
http://www.cs.berkeley.edu/~smcpeak/elkhound/
Parser generator directives are embedded in docstrings, and must begin with
a '%' character, followed immediately by one of several keywords:
Precedence:
``%fail`` ``%nonassoc`` ``%left`` ``%right`` ``%split``
Token:
``%token``
Non-terminal:
``%start`` ``%nonterm``
Production:
``%reduce``
All of these directives are associated with classes except for %reduce.
%reduce is associated with methods within non-terminal classes. The Parsing
module provides base classes from which precedences, tokens, and
non-terminals must be derived. This is not as restrictive as it sounds,
since there is nothing preventing, for example, a master Token class that
subclasses Parsing.Token, which all of the actual token types then subclass.
Also, nothing prevents using multiple inheritance.
Folowing are the base classes to be subclassed by parser specifications:
* Precedence
* Token
* Nonterm
The Parsing module implements the following exception classes:
* SpecError - when there is a problem with the grammar specification
* ParsingException - any problem that occurs during parsing
* UnexpectedToken - when the input sequence contains a token that is
not allowed by the grammar (including end-of-input)
In order to maintain compatibility with legacy code, the Parsing module
defines the following aliases. New code should use the exceptions above
that do not shadow Python's builtin exceptions.
* Exception - superclass for all exceptions that can be raised
* SyntaxError - alias for UnexpectedToken
Additionally, trying to set private attributes may raise:
* AttributeError
Author: Jason Evans jasone@canonware.com
Github repo: http://github.com/MagicStack/parsing
%package -n python3-parsing
Summary: A pure-Python module that implements an LR(1) parser generator, as well as CFSM and GLR parser drivers.
Provides: python-parsing
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
BuildRequires: python3-cffi
BuildRequires: gcc
BuildRequires: gdb
%description -n python3-parsing
The ``parsing`` module implements an LR(1) parser generator, as well as the
runtime support for using a generated parser, via the Lr and Glr parser
drivers. There is no special parser generator input file format, but the
parser generator still needs to know what classes/methods correspond to
various aspects of the parser. This information is specified via
docstrings, which the parser generator introspects in order to generate a
parser. Only one parser specification can be embedded in each module, but
it is possible to share modules between parser specifications so that, for
example, the same token definitions can be used by multiple parser
specifications.
The parsing tables are LR(1), but they are generated using a fast algorithm
that avoids creating duplicate states that result when using the generic
LR(1) algorithm. Creation time and table size are on par with the LALR(1)
algorithm. However, LALR(1) can create reduce/reduce conflicts that don't
exist in a true LR(1) parser. For more information on the algorithm, see::
A Practical General Method for Constructing LR(k) Parsers
David Pager
Acta Informatica 7, 249-268 (1977)
Parsing table generation requires non-trivial amounts of time for large
grammars, however it is still quite fast. Internal pickling support makes
it possible to cache the most recent version of the parsing table on disk,
and use the table if the current parser specification is still compatible
with the one that was used to generate the pickled parsing table. Since
the compatibility checking is quite fast, even for large grammars, this
removes the need to use the standard code generation method that is used
by most parser generators.
Parser specifications are encapsulated by the ``Spec`` class. Parser
instances use ``Spec`` instances, but are themselves based on separate
classes. This allows multiple parser instances to exist simultaneously,
without requiring multiple copies of the parsing tables. There are two
separate parser driver classes:
Lr:
Standard Characteristic Finite State Machine (CFSM) driver, based on
unambiguous LR(1) parsing tables. This driver is faster than the Glr
driver, but it cannot deal with all parsing tables that the Glr
driver can.
Glr:
Generalized LR driver, capable of tracking multiple parse trees
simultaneously, if the %split precedence is used to mark ambiguous
actions. This driver is closely based on Elkhound's design, which
is described in a technical report::
Elkhound: A Fast, Practical GLR Parser Generator
Scott McPeak
Report No. UCB/CSD-2-1214 (December 2002)
http://www.cs.berkeley.edu/~smcpeak/elkhound/
Parser generator directives are embedded in docstrings, and must begin with
a '%' character, followed immediately by one of several keywords:
Precedence:
``%fail`` ``%nonassoc`` ``%left`` ``%right`` ``%split``
Token:
``%token``
Non-terminal:
``%start`` ``%nonterm``
Production:
``%reduce``
All of these directives are associated with classes except for %reduce.
%reduce is associated with methods within non-terminal classes. The Parsing
module provides base classes from which precedences, tokens, and
non-terminals must be derived. This is not as restrictive as it sounds,
since there is nothing preventing, for example, a master Token class that
subclasses Parsing.Token, which all of the actual token types then subclass.
Also, nothing prevents using multiple inheritance.
Folowing are the base classes to be subclassed by parser specifications:
* Precedence
* Token
* Nonterm
The Parsing module implements the following exception classes:
* SpecError - when there is a problem with the grammar specification
* ParsingException - any problem that occurs during parsing
* UnexpectedToken - when the input sequence contains a token that is
not allowed by the grammar (including end-of-input)
In order to maintain compatibility with legacy code, the Parsing module
defines the following aliases. New code should use the exceptions above
that do not shadow Python's builtin exceptions.
* Exception - superclass for all exceptions that can be raised
* SyntaxError - alias for UnexpectedToken
Additionally, trying to set private attributes may raise:
* AttributeError
Author: Jason Evans jasone@canonware.com
Github repo: http://github.com/MagicStack/parsing
%package help
Summary: Development documents and examples for parsing
Provides: python3-parsing-doc
%description help
The ``parsing`` module implements an LR(1) parser generator, as well as the
runtime support for using a generated parser, via the Lr and Glr parser
drivers. There is no special parser generator input file format, but the
parser generator still needs to know what classes/methods correspond to
various aspects of the parser. This information is specified via
docstrings, which the parser generator introspects in order to generate a
parser. Only one parser specification can be embedded in each module, but
it is possible to share modules between parser specifications so that, for
example, the same token definitions can be used by multiple parser
specifications.
The parsing tables are LR(1), but they are generated using a fast algorithm
that avoids creating duplicate states that result when using the generic
LR(1) algorithm. Creation time and table size are on par with the LALR(1)
algorithm. However, LALR(1) can create reduce/reduce conflicts that don't
exist in a true LR(1) parser. For more information on the algorithm, see::
A Practical General Method for Constructing LR(k) Parsers
David Pager
Acta Informatica 7, 249-268 (1977)
Parsing table generation requires non-trivial amounts of time for large
grammars, however it is still quite fast. Internal pickling support makes
it possible to cache the most recent version of the parsing table on disk,
and use the table if the current parser specification is still compatible
with the one that was used to generate the pickled parsing table. Since
the compatibility checking is quite fast, even for large grammars, this
removes the need to use the standard code generation method that is used
by most parser generators.
Parser specifications are encapsulated by the ``Spec`` class. Parser
instances use ``Spec`` instances, but are themselves based on separate
classes. This allows multiple parser instances to exist simultaneously,
without requiring multiple copies of the parsing tables. There are two
separate parser driver classes:
Lr:
Standard Characteristic Finite State Machine (CFSM) driver, based on
unambiguous LR(1) parsing tables. This driver is faster than the Glr
driver, but it cannot deal with all parsing tables that the Glr
driver can.
Glr:
Generalized LR driver, capable of tracking multiple parse trees
simultaneously, if the %split precedence is used to mark ambiguous
actions. This driver is closely based on Elkhound's design, which
is described in a technical report::
Elkhound: A Fast, Practical GLR Parser Generator
Scott McPeak
Report No. UCB/CSD-2-1214 (December 2002)
http://www.cs.berkeley.edu/~smcpeak/elkhound/
Parser generator directives are embedded in docstrings, and must begin with
a '%' character, followed immediately by one of several keywords:
Precedence:
``%fail`` ``%nonassoc`` ``%left`` ``%right`` ``%split``
Token:
``%token``
Non-terminal:
``%start`` ``%nonterm``
Production:
``%reduce``
All of these directives are associated with classes except for %reduce.
%reduce is associated with methods within non-terminal classes. The Parsing
module provides base classes from which precedences, tokens, and
non-terminals must be derived. This is not as restrictive as it sounds,
since there is nothing preventing, for example, a master Token class that
subclasses Parsing.Token, which all of the actual token types then subclass.
Also, nothing prevents using multiple inheritance.
Folowing are the base classes to be subclassed by parser specifications:
* Precedence
* Token
* Nonterm
The Parsing module implements the following exception classes:
* SpecError - when there is a problem with the grammar specification
* ParsingException - any problem that occurs during parsing
* UnexpectedToken - when the input sequence contains a token that is
not allowed by the grammar (including end-of-input)
In order to maintain compatibility with legacy code, the Parsing module
defines the following aliases. New code should use the exceptions above
that do not shadow Python's builtin exceptions.
* Exception - superclass for all exceptions that can be raised
* SyntaxError - alias for UnexpectedToken
Additionally, trying to set private attributes may raise:
* AttributeError
Author: Jason Evans jasone@canonware.com
Github repo: http://github.com/MagicStack/parsing
%prep
%autosetup -n parsing-2.0.0
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-parsing -f filelist.lst
%dir %{python3_sitearch}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Thu Jun 08 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.0-1
- Package Spec generated
|