Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
parser-fplo
Commits
2d56fb29
Commit
2d56fb29
authored
Nov 10, 2016
by
Henning Glawe
Browse files
integrate FploInputParser into main parser via adHoc wrapper
parent
f50eacd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
parser/parser-fplo/parser_fplo_14.py
View file @
2d56fb29
...
...
@@ -15,6 +15,7 @@ import calendar
from
nomadcore.parser_backend
import
valueForStrValue
from
FploCommon
import
RE_f
,
RE_i
,
cRE_f
,
cRE_i
from
nomadcore.parser_backend
import
valueForStrValue
import
FploInputParser
LOGGER
=
logging
.
getLogger
(
__name__
)
...
...
@@ -184,6 +185,40 @@ class ParserFplo14(object):
def
adHoc_input_content
(
self
,
parser
):
LOGGER
.
error
(
"TODO: parse C-like echoed input"
)
input_parser
=
FploInputParser
.
FploInputParser
(
None
,
annotated_line_callback
=
self
.
callback_annotated_input_line
)
while
True
:
fInLine
=
parser
.
fIn
.
readline
()
if
re
.
match
(
r
'^\s*-{60,}\s*$'
,
fInLine
):
self
.
callback_annotated_input_line
(
fInLine
)
break
input_parser
.
parse_line
(
fInLine
)
input_parser
.
onEnd_of_file
()
def
callback_annotated_input_line
(
self
,
annotated_input_line
):
minfo
=
{
# raw line
'fInLine'
:
''
,
# fInLine,
'fInLineNr'
:
self
.
parser
.
fIn
.
lineNr
,
# information about SimpleMatcher
'matcherName'
:
'tokenizer'
,
'defFile'
:
'FploInputParser.py'
,
'defLine'
:
0
,
'matcher_does_nothing'
:
False
,
'which_re'
:
'tokenizer'
,
# classification of match
'matchFlags'
:
1
,
'match'
:
3
,
# 0 - no, 1 - partial, 3 - full
'coverageIgnore'
:
0
,
# 0 - no, 1 - local, 3 - global
# overall span of match, and spans of group captures
'span'
:
[],
# capture group names
'matcherGroup'
:
[],
# we have pre-highlighted line
'highlighted'
:
annotated_input_line
,
}
self
.
parser
.
annotator
.
annotate
(
minfo
)
def
SMs_input
(
self
):
result
=
[
...
...
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