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
c70537dd
Commit
c70537dd
authored
14 years ago
by
Paweł Kędzia
Browse files
Options
Downloads
Patches
Plain Diff
Base oeprator has been added.
parent
d8b86835
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libwccl/parser/grammar.g
+55
-10
55 additions, 10 deletions
libwccl/parser/grammar.g
with
55 additions
and
10 deletions
libwccl/parser/grammar.g
+
55
−
10
View file @
c70537dd
...
...
@@ -25,6 +25,7 @@ header {
#include <libwccl/ops/functions/bool/varsetter.h>
#include <libwccl/ops/functions/strset/affix.h>
#include <libwccl/ops/functions/strset/getorth.h>
#include <libwccl/ops/functions/strset/toupper.h>
#include <libwccl/ops/functions/strset/tolower.h>
...
...
@@ -37,6 +38,8 @@ header {
#include <libwccl/ops/functions/bool/predicates/isinside.h>
#include <libwccl/ops/functions/bool/predicates/isoutside.h>
#include <libwccl/ops/functions/position/relativeposition.h>
#include <libwccl/ops/functions/conditional.h>
// Unicode String
...
...
@@ -50,6 +53,8 @@ header {
options {
language = "Cpp";
genHashLines = false;
// namespace = "Wccl";
// genHashLines = true;
}
// ----------------------------------------------------------------------------
...
...
@@ -252,7 +257,7 @@ boolean_value
// returns boost::shared_ptr<Wccl::Position>
position_literal
returns [boost::shared_ptr<Wccl::Position> val]
: i: INT {
: i:
UNSIGNED_
INT {
val.reset(new Wccl::Position(Wccl::Position(token_ref_to_int(i))));
}
| "begin" {
...
...
@@ -277,6 +282,16 @@ position_value
}
;
// ----------------------------------------------------------------------------
// Number may be unsigned or signed
number returns [int ret]
{
ret = 0;
}
: s: SIGNED_INT { ret = token_ref_to_int(s); }
| u: UNSIGNED_INT { ret = token_ref_to_int(u); }
;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// VARIABLES
...
...
@@ -310,6 +325,25 @@ position_variable
}
;
// realtive position
relpos
[Wccl::Variables& vars]
returns [boost::shared_ptr<Wccl::Function<Wccl::Position> > ret]
{
boost::shared_ptr<Wccl::Function<Wccl::Position> > pos;
}
: "relpos"
LPAREN
pos = op_position [vars] ("+" | "-") ofst: UNSIGNED_INT
RPAREN {
ret.reset(new Wccl::RelativePosition(
pos,
token_ref_to_int(ofst)
)
);
}
;
// ----------------------------------------------------------------------------
// String set, $s:name
// This expression gets variable of the type StrSet from string-named variable
...
...
@@ -537,6 +571,7 @@ position_operators
returns [boost::shared_ptr<Wccl::Function<Wccl::Position> > ret]
: ret = op_position [vars]
;
// Implementations of symbol set operators:
// ----------------------------------------------------------------------------
op_position
...
...
@@ -544,6 +579,7 @@ op_position
returns [boost::shared_ptr<Wccl::Function<Wccl::Position> > op]
: op = position_variable [vars]
| op = position_value
| op = relpos [vars]
;
// ----------------------------------------------------------------------------
...
...
@@ -568,10 +604,10 @@ op_orth
[const Corpus2::Tagset& tagset, Wccl::Variables& vars]
returns [boost::shared_ptr<Wccl::Function<Wccl::StrSet> > ret]
{
boost::shared_ptr<Wccl::
VarGetter
<Wccl::Position> > pos;
boost::shared_ptr<Wccl::
Function
<Wccl::Position> > pos;
}
: "orth" LBRACKET pos = position
_variable
[vars] RBRACKET {
// ret = TODO
: "orth" LBRACKET pos =
op_
position [vars] RBRACKET {
ret.reset(new Wccl::GetOrth(pos));
}
;
// ----------------------------------------------------------------------------
...
...
@@ -612,12 +648,13 @@ op_affix
[const Corpus2::Tagset& tagset, Wccl::Variables& vars]
returns [boost::shared_ptr<Wccl::Function<Wccl::StrSet> > ret]
{
int offset = 0;
boost::shared_ptr<Wccl::Function<Wccl::StrSet> > o_ret;
}
: "affix" LPAREN
o_ret = string_operators[tagset, vars] COMMA
offset: INT
RPAREN {
ret.reset(new Wccl::Affix(o_ret,
token_ref_to_int(
offset))
)
;
o_ret = string_operators[tagset, vars] COMMA
offset = number
RPAREN {
ret.reset(new Wccl::Affix(o_ret, offset));
}
;
// ----------------------------------------------------------------------------
...
...
@@ -922,13 +959,21 @@ options {
| '\'' (~'\'')* '\''
;
INT
SIGNED_
INT
options {
paraphrase = "
I
nteger";
paraphrase = "
Signed i
nteger";
}
: ('-'|'+')
?
('0'..'9')+
: ('-'|'+') ('0'..'9')+
;
UNSIGNED_INT
options {
paraphrase = "Unsigned integer";
}
: ('0'..'9')+
;
QUOT_MARK
options {
paraphrase = "Quota mark";
...
...
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