Closed GoogleCodeExporter closed 9 years ago
Original comment by jeff.br...@gmail.com
on 30 Oct 2007 at 2:13
Julian, can we get the != syntax in for Alpha 1? The rest can wait.
Original comment by jeff.br...@gmail.com
on 30 Oct 2007 at 9:22
After discussing this with Julian, it seems the best approach is to just
rewrite the
parser code and to use a more composable syntax. Here's a quick and dirty
suggestion. Looks like we can get this into Alpha 1 too. Nice. ;-)
This syntax looks LL(1) to me, so we should be able to implement a simple
recursive
descent parser in a couple dozen lines that covers all of these cases.
<word> ::= [a-zA-Z0-9_\-]+ # unquoted word, this regex probably isn't
good
enough yet...
<string> ::= <word>
| '"' ([^\"]|\\.)* '"'
| "'" ([^\']|\\.)* "'"
<key> ::= <string>
<value> ::= <string> # value specified by exact string
| "~" <string> # value specified by regex
<match> ::= <value> # inclusion match of a value
| "!" <value> # exclusion match of a value
<matchSeq> ::= <match>
| <match> "," <matchSeq>
<filter> ::= <key> ":" <matchSeq>
| <filter> "|" <filter> # combine filters with OR
| <filter> "&" <filter> # combine filters with AND
| "!" <filter> # negate filter
| "(" <filter> ")" # grouping
Where NOT has highest precedence, then AND, then OR and these operators are
left-associative.
Original comment by jeff.br...@gmail.com
on 31 Oct 2007 at 2:09
Nix value-level exclusion. It's too confusing. Filter-level negation is fine.
Original comment by jeff.br...@gmail.com
on 9 Nov 2007 at 10:53
Note: Should allow "and", "or", and "not" to be used as synonyms for "&", "|"
and "!"
to simplify embedding of complex filter specifications within XML.
Original comment by jeff.br...@gmail.com
on 12 Nov 2007 at 8:11
I implemented this feature and updated the related documentation.
Original comment by julian.h...@gmail.com
on 26 Nov 2007 at 9:21
Original comment by julian.h...@gmail.com
on 26 Nov 2007 at 9:22
I added more unit tests last week and I'm working on improving the error
reporting.
Original comment by julian.h...@gmail.com
on 2 Dec 2007 at 10:54
After talking with Jeff, we agreed on performing the following changes:
- Use /.../ instead of ~"..." for defining regular expressions, and /.../i for
case-insensitive matches
- Redefine the word characters to be any printable character that's not
explicitly
reserved for other uses
- Introduce an ERROR token for lexer errors
Original comment by julian.h...@gmail.com
on 3 Dec 2007 at 11:12
Jeff suggested to simply throw out the "&", "|" and "!" operators since "and",
"or"
and "not" are good enough.
Original comment by julian.h...@gmail.com
on 4 Dec 2007 at 11:35
Hehe... keeping in mind that my suggestion may or may not be valid. I think I
can
make a good case for it though.
;-)
Original comment by jeff.br...@gmail.com
on 4 Dec 2007 at 11:36
Reopened the issue to address minor changes in the specs as described above.
Original comment by jeff.br...@gmail.com
on 4 Dec 2007 at 11:37
6. Fix the following bug:
TestCase 'FilterFormatterTest.RoundTripFormatting(not (Abc: 123 and not (Def:
456 or
not Ghi: 789))' failed:
System.Exception: Right bracket expected
C:\Source\MbUnit\v3\src\Gallio\Gallio\Model\Filters\FilterParser.cs(223,0): at
Gallio.Model.Filters.FilterParser`1.MatchRightBracket(FilterLexer lexer)
The problem happens because the grammar's precendence rules are not quite
correct.
I think they should be:
Filter -> OrFilter
OrFilter -> AndFilter 'or' OrFilter
-> AndFilter
AndFilter -> ParenFilter 'or' AndFilter
-> ParenFilter
NotFilter -> 'not' NotFilter
-> ParenFilter
ParenFilter -> '(' OrFilter ')'
-> Filter
SimpleFilter -> Key ':' Value
Here are some more test cases for you to work with:
- "not (Abc: 123 and not (Def: 456 or not Ghi: 789)"
- "not (not not (((Abc: def))))"
- "Abc: /123 456 \/ 789/i"
- "* and * or * and *" === "(* and *) or (* and *)"
- "* or * and * or *" === "* or (* and *) or *"
- "not * or not * and *" === "(not *) or ((not *) and *)"
When you're done making these changes, you'll want to run the
FilterFormatterTests to
check. I wrote them under the assumption that the parser would change as
specified.
Jeff.
P.S. The new "*" token means AnyFilter. It's purpose is to provide a non-empty
token that represents a totally inclusive filter. With the "*" token in place,
we
can then disallow empty filter specifications altogether. So "*" on its own
becomes
the default filter. This is nice because it ensures the filter is always
printable.
-----Original Message-----
From: Jeff Brown
Sent: Thursday, December 27, 2007 2:30 PM
To: 'Julián Hidalgo'
Subject: RE: Filter Parser work.
3. Remove support for &, | and !.
4. Update the documentation accordingly.
5. Add a test for "ExactType" which is like "Type" but does not include derived
types.
Jeff.
-----Original Message-----
From: Jeff Brown
Sent: Thursday, December 27, 2007 2:22 PM
To: 'Julián Hidalgo'
Subject: Filter Parser work.
A couple of remaining items:
1. It doesn't look like the new Regex syntax is supported yet. eg. /some
regex/i
(no quotes needed)
2. It also seems we'll need a token for an "any" filter. So let's make "*"
produce
an AnyFilter<T>.
Sound good? I'd like to get this stuff finished in time for Alpha 2 this
weekend.
Jeff.
Original comment by jeff.br...@gmail.com
on 6 Jan 2008 at 7:22
> 6. Fix the following bug:
>
> TestCase 'FilterFormatterTest.RoundTripFormatting(not (Abc: 123 and not (Def:
456
or not Ghi: 789))' failed:
> System.Exception: Right bracket expected
> C:\Source\MbUnit\v3\src\Gallio\Gallio\Model\Filters\FilterParser.cs(223,0): at
Gallio.Model.Filters.FilterParser`1.MatchRightBracket(FilterLexer lexer)
Actually there was a missing bracket:
not (Abc: 123 and not (Def: 456 or not Ghi: 789)
Should have been
not (Abc: 123 and not (Def: 456 or not Ghi: 789))
:)
Original comment by julian.h...@gmail.com
on 14 Jan 2008 at 2:37
I implemented all the changes.
Original comment by julian.h...@gmail.com
on 14 Jan 2008 at 7:08
Original comment by jeff.br...@gmail.com
on 22 Feb 2008 at 8:05
Original issue reported on code.google.com by
jeff.br...@gmail.com
on 30 Oct 2007 at 2:04