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
31c7ad78
Commit
31c7ad78
authored
14 years ago
by
Paweł Kędzia
Browse files
Options
Downloads
Patches
Plain Diff
Added user-parser rule for parsing single rule
parent
5862c134
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libwccl/parser/Parser.cpp
+31
-0
31 additions, 0 deletions
libwccl/parser/Parser.cpp
libwccl/parser/Parser.h
+7
-0
7 additions, 0 deletions
libwccl/parser/Parser.h
with
38 additions
and
0 deletions
libwccl/parser/Parser.cpp
+
31
−
0
View file @
31c7ad78
...
@@ -323,4 +323,35 @@ boost::shared_ptr<RuleSequence> Parser::parseRuleSequence(
...
@@ -323,4 +323,35 @@ boost::shared_ptr<RuleSequence> Parser::parseRuleSequence(
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
/**
* @desc Parse single rule contained in a std::string. Converts the string
* to a stream and calls parseSingleRule with it
* @arg str rule
* @return the parsed rule via a shared pointer
*/
boost
::
shared_ptr
<
Rule
>
Parser
::
parseSingleRule
(
const
std
::
string
&
str
)
const
{
std
::
stringstream
ss
(
std
::
stringstream
::
in
|
std
::
stringstream
::
out
);
ss
<<
str
;
return
this
->
parseSingleRule
(
ss
);
}
/**
* @desc Parse a sequence rules. Runs parse_rule_sequence rule in the parser
* grammar.
* @arg istr input stream with writed rules
* @return the parsed rule sequence via a shared pointer
*/
boost
::
shared_ptr
<
Rule
>
Parser
::
parseSingleRule
(
std
::
istream
&
istr
)
const
{
ANTLRLexer
lexer
(
istr
);
ANTLRParser
parser
(
lexer
);
return
parser
.
parse_single_rule
(
tagset_
);
}
// ----------------------------------------------------------------------------
}
// end Wccl ns
}
// end Wccl ns
This diff is collapsed.
Click to expand it.
libwccl/parser/Parser.h
+
7
−
0
View file @
31c7ad78
...
@@ -71,6 +71,13 @@ public:
...
@@ -71,6 +71,13 @@ public:
boost
::
shared_ptr
<
RuleSequence
>
boost
::
shared_ptr
<
RuleSequence
>
parseRuleSequence
(
std
::
istream
&
)
const
;
parseRuleSequence
(
std
::
istream
&
)
const
;
// ---------------------------------------------------------------------------
// Parsing single rule from input string
boost
::
shared_ptr
<
Rule
>
parseSingleRule
(
const
std
::
string
&
)
const
;
boost
::
shared_ptr
<
Rule
>
parseSingleRule
(
std
::
istream
&
)
const
;
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
const
Corpus2
::
Tagset
&
tagset
()
const
{
const
Corpus2
::
Tagset
&
tagset
()
const
{
return
tagset_
;
return
tagset_
;
...
...
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