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
26401e18
Commit
26401e18
authored
14 years ago
by
Paweł Kędzia
Browse files
Options
Downloads
Patches
Plain Diff
Values and variables for the MatchVector type
parent
17c65289
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libwccl/parser/grammar.g
+102
-0
102 additions, 0 deletions
libwccl/parser/grammar.g
with
102 additions
and
0 deletions
libwccl/parser/grammar.g
+
102
−
0
View file @
26401e18
...
...
@@ -67,6 +67,10 @@ header {
#include <libwccl/ops/tagactions/select.h>
#include <libwccl/ops/tagactions/relabel.h>
// Match operators
#include <libwccl/values/tokenmatch.h>
#include <libwccl/values/annotationmatch.h>
#include <libwccl/ops/match/applyoperator.h>
// Unicode String
#include <unicode/uniset.h>
...
...
@@ -379,6 +383,67 @@ position_value
}
;
// ----------------------------------------------------------------------------
// Value used into match operator such as TOK[position] and ANN[position, name]
// Returns boost::shared_ptr<Match>
match_value
returns [boost::shared_ptr<Match> val]
: val = token_match_value
| val = ann_match_value
| val = match_vector_value
;
// token match value
// Returns boost::shared_ptr<TokenMatch>
token_match_value
returns [boost::shared_ptr<TokenMatch> val]
{
boost::shared_ptr<Position> p;
}
: "TOK"LBRACKET p = position_literal RBRACKET {
val.reset(new TokenMatch(*p));
}
;
// annotation match value
// Returns boost::shared_ptr<AnnotationMatch>
ann_match_value
returns [boost::shared_ptr<AnnotationMatch> val]
{
boost::shared_ptr<Position> p;
}
: "ANN" LBRACKET p = position_literal COMMA channel : STRING RBRACKET {
val.reset(new AnnotationMatch(*p, token_ref_to_std_string(channel)));
}
;
// annotation match vector: MATCH() or MATCH(token, ann, MATCH())
// Returns boost::shared_ptr<MatchVector>
match_vector_value
returns [boost::shared_ptr<MatchVector> val]
{
val.reset(new MatchVector());
}
: "MATCH" LPAREN (match_vector_value_item[val])? RPAREN
;
// Body of the MATCH value. It only adds vector items to the MatchVector
// Item may be single or multiple
match_vector_value_item [boost::shared_ptr<MatchVector>& mvector]
{
boost::shared_ptr<Match> m_val;
}
: m_val = match_value {
mvector->append(m_val);
}
(
COMMA
m_val = match_value {
mvector->append(m_val);
}
)*
;
// ----------------------------------------------------------------------------
// Number may be unsigned or signed: 1, +1, -1
number
...
...
@@ -517,6 +582,36 @@ bool_variable
}
;
// ----------------------------------------------------------------------------
// Match: $m:name
// Get mach vector variable from variavles (before put into variables)
// Returns boost::shared_ptr<VariableAccessor<Match> >
match_vector_variable_acc
[Variables& vars]
returns [boost::shared_ptr<VariableAccessor<Match> > mvv_acc]
: MATCH_VECTOR_PREFIX n: SYMBOL {
vars.get_put<Match>(str_token_rem_grav(n));
VariableAccessor<Match> acc =
vars.create_accessor<Match>(str_token_rem_grav(n));
mvv_acc.reset(new VariableAccessor<Match>(acc));
}
;
// Vargetter for the match vector variavle. Wrapper for match_vector_variable_acc
// Returns boost::shared_ptr<VarGetter<Match> >
match_vector_variable
[Variables& vars]
returns [boost::shared_ptr<VarGetter<Match> > mvv]
{
boost::shared_ptr<VariableAccessor<Match> > mvv_acc;
}
: mvv_acc = match_vector_variable_acc [vars] {
mvv.reset(new VarGetter<Match>(*mvv_acc));
}
;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// OPERATORS
...
...
@@ -1678,6 +1773,13 @@ options {
: '$'
;
MATCH_VECTOR_PREFIX
options {
paraphrase = "Match vector prefix";
}
: "$m:"
;
LBRACKET
options {
paraphrase = "'['";
...
...
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