summaryrefslogtreecommitdiff
path: root/src/piraha/Literal.cc
diff options
context:
space:
mode:
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;
+ }
+}