aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlx_goal.peg
diff options
context:
space:
mode:
authorEric <[email protected]>2013-05-09 17:04:18 -0700
committerEric <[email protected]>2013-05-09 17:04:18 -0700
commitefbdfbe117939cd50d0252a210b9b7634de42bb4 (patch)
tree74b0bad39d3a5b25bd4199728c16c0b1a4ade703 /src/rlx_goal.peg
parent0d5a803a28010cc956948b614408b9d38997e9a1 (diff)
downloadrelx-efbdfbe117939cd50d0252a210b9b7634de42bb4.tar.gz
relx-efbdfbe117939cd50d0252a210b9b7634de42bb4.tar.bz2
relx-efbdfbe117939cd50d0252a210b9b7634de42bb4.zip
Basic file rename from rcl to rlx
Diffstat (limited to 'src/rlx_goal.peg')
-rw-r--r--src/rlx_goal.peg55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/rlx_goal.peg b/src/rlx_goal.peg
new file mode 100644
index 0000000..bfac607
--- /dev/null
+++ b/src/rlx_goal.peg
@@ -0,0 +1,55 @@
+
+constraint <- ws? app_name ws? between_op ws? version ws? "," ws? version ws? !.
+ / ws? app_name ws? constraint_op ws? version ws? !.
+ / ws? app_name ws? !.
+
+ `
+ case Node of
+ [_,AppName,_, _] ->
+ {ok, AppName};
+ [_,AppName,_,Op,_,Vsn,_, _] ->
+ {ok,
+ {AppName,
+ rcl_goal_utils:to_vsn(Vsn),
+ rcl_goal_utils:to_op(Op)}};
+ [_,AppName,_,Op,_,Vsn1,_,_,_,Vsn2,_,_] ->
+ {ok,
+ {AppName,
+ rcl_goal_utils:to_vsn(Vsn1),
+ rcl_goal_utils:to_vsn(Vsn2),
+ rcl_goal_utils:to_op(Op)}};
+ _ ->
+ io:format("~p~n", [Node])
+ end
+ ` ;
+
+ws <- [ \t\n\s\r] ;
+
+app_name <- [a-zA-Z0-9_]+
+ ` erlang:list_to_atom(erlang:binary_to_list(erlang:iolist_to_binary(Node))) ` ;
+
+between_op <-
+ ":" ws? ( "btwn" / "between" ) ws? ":"
+ ` case Node of
+ [C,_,Op,_,C] -> erlang:iolist_to_binary([C,Op,C]);
+ _ -> Node
+ end
+ ` ;
+
+constraint_op <- "=" / "-" / "<=" / "<" / "~>" / ">=" / ">" / word_constraint_op / ":" ;
+
+word_constraint_op <-
+ ":" ws? ( "gte" / "lte" / "gt" / "lt" / "pes" ) ws? ":"
+ ` case Node of
+ [C,_,Op,_,C] -> erlang:iolist_to_binary([C,Op,C]);
+ _ -> Node
+ end
+ ` ;
+
+
+version <- [0-9a-zA-Z-+.]+ ;
+
+%% This only exists to get around a bug in erlang where if
+%% warnings_as_errors is specified `nowarn` directives are ignored
+
+ `-compile(export_all).` \ No newline at end of file