summaryrefslogtreecommitdiff
path: root/src/piraha/Literal.cc
diff options
context:
space:
mode:
authorsbrandt <sbrandt@17b73243-c579-4c4c-a9d2-2d5706c11dac>2013-02-25 16:54:00 +0000
committersbrandt <sbrandt@17b73243-c579-4c4c-a9d2-2d5706c11dac>2013-02-25 16:54:00 +0000
commit4730bc03f50318da9432bbd17f7c9cc91de1eb21 (patch)
tree740a46e73a289157f7cc45e281ecfdfb686977e5 /src/piraha/Literal.cc
parentf9f8fb05dc03fa339e37a04608009f62e4fcc3b0 (diff)
Change the parameter parser to Piraha
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4960 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/piraha/Literal.cc')
-rw-r--r--src/piraha/Literal.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/piraha/Literal.cc b/src/piraha/Literal.cc
new file mode 100644
index 00000000..eedae466
--- /dev/null
+++ b/src/piraha/Literal.cc
@@ -0,0 +1,18 @@
+#include "Piraha.hpp"
+
+bool Literal::match(Matcher *m) {
+ if(m->pos - m->input_size >= 0)
+ return false;
+ if(m->input[m->pos] == c) {
+ m->max_pos = std::max(m->pos,m->max_pos);
+ m->pos++;
+ return true;
+ } else {
+ if(m->pos == m->max_pos+1) {
+ Bracket bex;
+ bex.addRange(c,c);
+ m->fail(&bex);
+ }
+ return false;
+ }
+}