Add parser
diff --git a/Matcher.h b/Matcher.h
index 84aee15..24fc795 100644
--- a/Matcher.h
+++ b/Matcher.h
@@ -3,17 +3,20 @@
#include "Token.h"
#include "VarContext.h"
-struct MatchResult {
+struct MatchResult
+{
bool success;
VarContext context;
};
template <typename T>
-bool listStartsWith(const QList<T> &haystack, const QList<T> &needle) {
+bool listStartsWith(const QList<T> &haystack, const QList<T> &needle)
+{
if (needle.length() > haystack.length())
return false;
- for (int i = 0; i < needle.length(); i++) {
+ for (int i = 0; i < needle.length(); i++)
+ {
if (haystack[i] != needle[i])
return false;
}
@@ -22,19 +25,23 @@
}
template <typename T>
-void listDrop(QList<T> &list, int n) {
- for (; n; n--) {
+void listDrop(QList<T> &list, int n)
+{
+ for (; n; n--)
+ {
list.removeFirst();
}
}
template <typename T>
-QList<T> listSlice(QList<T> &list, int from, int to) {
+QList<T> listSlice(QList<T> &list, int from, int to)
+{
QList<T> prime;
// I guess we'll just panic if it's too long
// TODO: ERROR HANDLING
- for (int i = 0; i < to - from; i++) {
+ for (int i = 0; i < to - from; i++)
+ {
prime.append(list[from + i]);
}