Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
badw-it
DHParser
Commits
2544e15b
Commit
2544e15b
authored
Jan 25, 2019
by
eckhart
Browse files
- reset added to Pop-parser
parent
91bc9516
Changes
3
Show whitespace changes
Inline
Side-by-side
DHParser/error.pxd
View file @
2544e15b
...
@@ -2,3 +2,12 @@
...
@@ -2,3 +2,12 @@
#cython: language_level=3
#cython: language_level=3
#cython: c_string_type=unicode
#cython: c_string_type=unicode
#cython: c_string_encoding=utf-8
#cython: c_string_encoding=utf-8
import
cython
@
cython
.
locals
(
i
=
cython
.
int
)
cpdef
linebreaks
(
test
)
@
cython
.
locals
(
line
=
cython
.
int
,
column
=
cython
.
int
)
cpdef
line_col
(
lbreaks
,
pos
)
DHParser/parse.pxd
View file @
2544e15b
...
@@ -12,6 +12,11 @@ cdef class Parser:
...
@@ -12,6 +12,11 @@ cdef class Parser:
cdef
object
cycle_detection
cdef
object
cycle_detection
cpdef
_parse
(
self
,
text
)
cpdef
_parse
(
self
,
text
)
cpdef
reset
(
self
)
cpdef
_apply
(
self
,
func
,
flip
)
# cpdef push_rollback__(self, int location, func)
# cpdef rollback_to__(self, int location)
# cpdef line_col__(self, text)
cdef
class
Grammar
:
cdef
class
Grammar
:
cdef
dict
__dict__
cdef
dict
__dict__
...
...
DHParser/parse.py
View file @
2544e15b
...
@@ -1251,7 +1251,7 @@ class UnaryOperator(Parser):
...
@@ -1251,7 +1251,7 @@ class UnaryOperator(Parser):
return
duplicate
return
duplicate
def
_apply
(
self
,
func
:
ApplyFunc
,
flip
:
FlagFunc
)
->
bool
:
def
_apply
(
self
,
func
:
ApplyFunc
,
flip
:
FlagFunc
)
->
bool
:
if
super
().
_apply
(
func
,
flip
):
if
super
(
UnaryOperator
,
self
).
_apply
(
func
,
flip
):
self
.
parser
.
_apply
(
func
,
flip
)
self
.
parser
.
_apply
(
func
,
flip
)
return
True
return
True
return
False
return
False
...
@@ -1282,7 +1282,7 @@ class NaryOperator(Parser):
...
@@ -1282,7 +1282,7 @@ class NaryOperator(Parser):
return
duplicate
return
duplicate
def
_apply
(
self
,
func
:
ApplyFunc
,
flip
:
FlagFunc
)
->
bool
:
def
_apply
(
self
,
func
:
ApplyFunc
,
flip
:
FlagFunc
)
->
bool
:
if
super
().
_apply
(
func
,
flip
):
if
super
(
NaryOperator
,
self
).
_apply
(
func
,
flip
):
for
parser
in
self
.
parsers
:
for
parser
in
self
.
parsers
:
parser
.
_apply
(
func
,
flip
)
parser
.
_apply
(
func
,
flip
)
return
True
return
True
...
@@ -2070,6 +2070,9 @@ class Pop(Retrieve):
...
@@ -2070,6 +2070,9 @@ class Pop(Retrieve):
"""
"""
def
__init__
(
self
,
symbol
:
Parser
,
rfilter
:
RetrieveFilter
=
None
)
->
None
:
def
__init__
(
self
,
symbol
:
Parser
,
rfilter
:
RetrieveFilter
=
None
)
->
None
:
super
().
__init__
(
symbol
,
rfilter
)
super
().
__init__
(
symbol
,
rfilter
)
def
reset
(
self
):
super
(
Pop
,
self
).
reset
()
self
.
values
=
[]
self
.
values
=
[]
def
__deepcopy__
(
self
,
memo
):
def
__deepcopy__
(
self
,
memo
):
...
@@ -2203,7 +2206,7 @@ class Forward(Parser):
...
@@ -2203,7 +2206,7 @@ class Forward(Parser):
self
.
parser
=
parser
self
.
parser
=
parser
def
_apply
(
self
,
func
:
ApplyFunc
,
flip
:
FlagFunc
)
->
bool
:
def
_apply
(
self
,
func
:
ApplyFunc
,
flip
:
FlagFunc
)
->
bool
:
if
super
().
_apply
(
func
,
flip
):
if
super
(
Forward
,
self
).
_apply
(
func
,
flip
):
self
.
parser
.
_apply
(
func
,
flip
)
self
.
parser
.
_apply
(
func
,
flip
)
return
True
return
True
return
False
return
False
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment