From 7a8c9289f743937e76569ba573df8beb4acf1a46 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20K=C4=99dzia?= <pawel.kedzia@pwr.wroc.pl>
Date: Thu, 21 Apr 2011 22:27:52 +0200
Subject: [PATCH] Added is() operator to the grammar

---
 libwccl/parser/grammar.g | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libwccl/parser/grammar.g b/libwccl/parser/grammar.g
index 94ccdac..67f50a1 100644
--- a/libwccl/parser/grammar.g
+++ b/libwccl/parser/grammar.g
@@ -81,6 +81,7 @@ header {
 	#include <libwccl/ops/match/applyoperator.h>
 	#include <libwccl/ops/match/conditions/optionalmatch.h>
 	#include <libwccl/ops/match/conditions/repeatedmatch.h>
+	#include <libwccl/ops/match/conditions/isannotatedas.h>
 	#include <libwccl/ops/match/conditions/conjconditions.h>
 	#include <libwccl/ops/match/conditions/tokencondition.h>
 	#include <libwccl/ops/match/actions/markmatch.h>
@@ -1998,6 +1999,7 @@ match_cond_all
 	: ret = match_cond_optional [tagset, vars]
 	| ret = match_cond_repeate  [tagset, vars]
 	| ret = match_cond_token    [tagset, vars]
+	| ret = match_cond_is
 ;
 
 // Match condition - token (wraps a L0 predicate)
@@ -2040,6 +2042,15 @@ match_cond_repeate
 	}
 ;
 
+// Match condition - is(ann_name)
+// Returns boost::shared_ptr<IsAnnotatedAs>
+match_cond_is
+	returns [boost::shared_ptr<IsAnnotatedAs> mtch]
+	: "is" LPAREN annotation_name: STRING RPAREN {
+		mtch.reset(new IsAnnotatedAs(token_ref_to_std_string(annotation_name)));
+	}
+;
+
 // ----------------------------------------------------------------------------
 
 // Match actions. Match action can be mark or unmark
-- 
GitLab