Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WCCL
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
WCCL
Commits
b587d7cc
Commit
b587d7cc
authored
14 years ago
by
Adam Wardynski
Browse files
Options
Downloads
Patches
Plain Diff
Rework dumping variables a bit, plus add string version.
parent
52e2cc99
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libwccl/ops/parsedexpression.h
+29
-9
29 additions, 9 deletions
libwccl/ops/parsedexpression.h
wcclparser/main.cpp
+1
-1
1 addition, 1 deletion
wcclparser/main.cpp
with
30 additions
and
10 deletions
libwccl/ops/parsedexpression.h
+
29
−
9
View file @
b587d7cc
...
...
@@ -139,18 +139,19 @@ public:
*/
boost
::
shared_ptr
<
ParsedExpression
>
clone_clean_ptr
()
const
;
/**
* Dup all variables to error stream.
* @returns String with representation of all held variables,
* in form of "variable = value" pairs, each pair on one line.
*/
void
dumpvariables
(
const
Corpus2
::
Tagset
&
tagset
)
{
typedef
std
::
pair
<
std
::
string
,
boost
::
shared_ptr
<
Wccl
::
Value
>
>
v_t
;
std
::
string
variables_string
(
const
Corpus2
::
Tagset
&
tagset
)
const
;
foreach
(
const
v_t
&
v
,
variables_
->
get_all
<
Wccl
::
Value
>
())
{
std
::
cerr
<<
v
.
second
->
make_var_repr
(
v
.
first
)
<<
"="
<<
v
.
second
->
to_string
(
tagset
)
<<
"
\n
"
;
}
}
/**
* Dump all variables to an output stream, in form of
* "variable = value" pairs, each pair on another line.
* @returns Stream written to.
*/
std
::
ostream
&
dump_variables
(
std
::
ostream
&
ostream
,
const
Corpus2
::
Tagset
&
tagset
)
const
;
protected:
explicit
ParsedExpression
(
const
Variables
&
variables
);
...
...
@@ -231,6 +232,25 @@ boost::shared_ptr<ParsedExpression> ParsedExpression::clone_clean_ptr() const {
return
copy
;
}
inline
std
::
ostream
&
ParsedExpression
::
dump_variables
(
std
::
ostream
&
ostream
,
const
Corpus2
::
Tagset
&
tagset
)
const
{
typedef
std
::
pair
<
std
::
string
,
boost
::
shared_ptr
<
Wccl
::
Value
>
>
v_t
;
foreach
(
const
v_t
&
v
,
variables_
->
get_all
<
Wccl
::
Value
>
())
{
ostream
<<
v
.
second
->
make_var_repr
(
v
.
first
)
<<
"="
<<
v
.
second
->
to_string
(
tagset
)
<<
"
\n
"
;
}
return
ostream
;
}
inline
std
::
string
ParsedExpression
::
variables_string
(
const
Corpus2
::
Tagset
&
tagset
)
const
{
std
::
ostringstream
oss
;
dump_variables
(
oss
,
tagset
);
return
oss
.
str
();
}
}
/* end ns Wccl */
#endif // LIBWCCL_OPS_PARSEDEXPRESSION_H
This diff is collapsed.
Click to expand it.
wcclparser/main.cpp
+
1
−
1
View file @
b587d7cc
...
...
@@ -126,7 +126,7 @@ bool process_line(const std::string& line, Wccl::Parser& parser,
<<
retVal
->
to_string
(
parser
.
tagset
())
<<
std
::
endl
;
if
(
dump_variables
)
{
retOp
->
dumpvariables
(
parser
.
tagset
());
retOp
->
dump
_
variables
(
std
::
cerr
,
parser
.
tagset
());
}
}
else
{
std
::
cerr
<<
"Problem while parsing -- "
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment