aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/filt/filt.peg
diff options
context:
space:
mode:
authorSachin Kelkar <sachinkel19@gmail.com>2017-01-23 18:38:49 +0530
committerSachin Kelkar <sachinkel19@gmail.com>2017-01-23 18:38:49 +0530
commit981329485429e2a3e10309250b8d2772094d52db (patch)
tree44d91dae848056c8d6deee415732266b6c6d58f3 /web/src/js/filt/filt.peg
parent2b2292f432a568b037ae06189436ed737aad66a8 (diff)
downloadmitmproxy-981329485429e2a3e10309250b8d2772094d52db.tar.gz
mitmproxy-981329485429e2a3e10309250b8d2772094d52db.tar.bz2
mitmproxy-981329485429e2a3e10309250b8d2772094d52db.zip
Merge NullaryExpr, UnaryExpr and BooleanLiteral
Diffstat (limited to 'web/src/js/filt/filt.peg')
-rw-r--r--web/src/js/filt/filt.peg43
1 files changed, 19 insertions, 24 deletions
diff --git a/web/src/js/filt/filt.peg b/web/src/js/filt/filt.peg
index 70cb4f65..64780d8a 100644
--- a/web/src/js/filt/filt.peg
+++ b/web/src/js/filt/filt.peg
@@ -224,38 +224,33 @@ BindingExpr
{ return binding(expr); }
/ Expr
-Expr
- = NullaryExpr
- / UnaryExpr
+/* All the filters except "~s" and "~src" are arranged in the ascending order as
+ given in the docs(http://docs.mitmproxy.org/en/latest/features/filters.html).
+ "~s" and "~src" are so arranged as "~s" caused problems in the evaluation of
+ "~src". */
-NullaryExpr
- = BooleanLiteral
+Expr
+ = "true" { return trueFilter; }
+ / "false" { return falseFilter; }
/ "~a" { return assetFilter; }
+ / "~c" ws+ s:IntegerLiteral { return responseCode(s); }
+ / "~d" ws+ s:StringLiteral { return domain(s); }
+ / "~dst" ws+ s:StringLiteral { return destination(s); }
/ "~e" { return errorFilter; }
+ / "~h" ws+ s:StringLiteral { return header(s); }
+ / "~hq" ws+ s:StringLiteral { return requestHeader(s); }
+ / "~hs" ws+ s:StringLiteral { return responseHeader(s); }
/ "~http" { return httpFilter; }
+ / "~m" ws+ s:StringLiteral { return method(s); }
/ "~marked" { return markedFilter; }
/ "~q" { return noResponseFilter; }
+ / "~src" ws+ s:StringLiteral { return source(s); }
/ "~s" { return responseFilter; }
+ / "~t" ws+ s:StringLiteral { return contentType(s); }
/ "~tcp" { return tcpFilter; }
-
-
-BooleanLiteral
- = "true" { return trueFilter; }
- / "false" { return falseFilter; }
-
-UnaryExpr
- = "~c" ws+ s:IntegerLiteral { return responseCode(s); }
- / "~d" ws+ s:StringLiteral { return domain(s); }
- / "~dst" ws+ s:StringLiteral { return destination(s); }
- / "~h" ws+ s:StringLiteral { return header(s); }
- / "~hq" ws+ s:StringLiteral { return requestHeader(s); }
- / "~hs" ws+ s:StringLiteral { return responseHeader(s); }
- / "~m" ws+ s:StringLiteral { return method(s); }
- / "~src" ws+ s:StringLiteral { return source(s); }
- / "~t" ws+ s:StringLiteral { return contentType(s); }
- / "~tq" ws+ s:StringLiteral { return requestContentType(s); }
- / "~ts" ws+ s:StringLiteral { return responseContentType(s); }
- / "~u" ws+ s:StringLiteral { return url(s); }
+ / "~tq" ws+ s:StringLiteral { return requestContentType(s); }
+ / "~ts" ws+ s:StringLiteral { return responseContentType(s); }
+ / "~u" ws+ s:StringLiteral { return url(s); }
/ s:StringLiteral { return url(s); }
IntegerLiteral "integer"