Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
arpeggio-gm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
backend
arpeggio-gm
Commits
60abc657
Commit
60abc657
authored
Sep 08, 2014
by
Igor Dejanovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for custom regex match string representation
parent
62080f76
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
__init__.py
arpeggio/__init__.py
+7
-3
No files found.
arpeggio/__init__.py
View file @
60abc657
...
...
@@ -576,18 +576,22 @@ class RegExMatch(Match):
It will be used to create regular expression using re.compile.
ignore_case(bool): If case insensitive match is needed.
Default is None to support propagation from global parser setting.
str_repr(str): A string that is used to represent this regex.
'''
def
__init__
(
self
,
to_match
,
rule_name
=
''
,
root
=
False
,
ignore_case
=
None
):
def
__init__
(
self
,
to_match
,
rule_name
=
''
,
root
=
False
,
ignore_case
=
None
,
str_repr
=
None
):
super
(
RegExMatch
,
self
)
.
__init__
(
rule_name
,
root
)
self
.
to_match
=
to_match
self
.
to_match
_regex
=
to_match
self
.
ignore_case
=
ignore_case
self
.
to_match
=
str_repr
if
str_repr
is
not
None
else
to_match
def
compile
(
self
):
flags
=
re
.
MULTILINE
if
self
.
ignore_case
:
flags
|=
re
.
IGNORECASE
self
.
regex
=
re
.
compile
(
self
.
to_match
,
flags
)
self
.
regex
=
re
.
compile
(
self
.
to_match
_regex
,
flags
)
def
__str__
(
self
):
return
self
.
to_match
...
...
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