File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -47,11 +47,11 @@ agoFormat returns [DateTime result]
4747@init {
4848 $result = DateTime.now();
4949}
50- : amount=NUMBER (
50+ : SINCE ? amount=NUMBER (
5151 HOURS {$result = $result.minusHours($amount.int ); }
5252 | MINUTES {$result = $result.minusMinutes($amount.int ); }
5353 | SECONDS {$result = $result.minusSeconds($amount.int ); }
54- ) AGO ;
54+ ) AGO ? ;
5555
5656date : NUMBER (DOT |MINUS ) NUMBER (DOT |MINUS ) NUMBER ;
5757
Original file line number Diff line number Diff line change @@ -41,6 +41,17 @@ public void shouldParseHrsAgoCommand() {
4141 System .out .println (command .newItem );
4242 }
4343
44+ @ Test
45+ public void shouldParseSinceHrsAgoCommand () {
46+ String commandToParse = "test 1 since 2 hrs ago" ;
47+ CharStream input = new ANTLRInputStream (commandToParse );
48+ EnglishCommandsLexer lexer = new EnglishCommandsLexer (input );
49+ EnglishCommandsParser parser = new EnglishCommandsParser (
50+ new CommonTokenStream (lexer ));
51+ CommandContext command = parser .command ();
52+ System .out .println (command .newItem );
53+ }
54+
4455 @ Test
4556 public void shouldParseSinceCommand () {
4657 String commandToParse = "test 1 since 10:00:00" ;
You can’t perform that action at this time.
0 commit comments