Could we leverage maven version parsing algorithms? Maven seems to be
able to parse a lot of crap :)

-Andrew

On Fri, Apr 18, 2008 at 1:09 PM, Matt Cooper <[EMAIL PROTECTED]> wrote:
> I agree, full agent "version" matching is troublesome.  With this approach:
>
>
>  @agent ie and (min-major-version: 6) and (min-minor-version: 1) and
>  (max-major-version: 6) {
>   /* styles for IE agent version 6.1 through 6.x (inclusive) */
>  }
>
>  We could go up to as many decimal tokens as we wish, e.g.
>  *-major-version, *-minor-version, *-maintenance-version,
>  *-build-version for "major.minor.maintenance.build" tokens.
>
>  ----
>
>  The question I would have then is what should we do with non-numeric
>  values like you pointed out; do we really care about skinning for
>  alphabetical versions?
>
>  My proposal would be to take the raw version String and split it into
>  up into tokens based on the dot character.  We should decide how many
>  tokens we want to support and then we should ignore any further tokens
>  in the String.
>  For each token, we turn it into an integer.  If the token contains
>  something other than decimal characters, keep only up to the first
>  non-decimal character.  Here are some examples:
>  a.) "0b5" would become "0"
>  b.)  "b5" would become "" which we'd treat as "0"
>
>  Regards,
>  Matt
>
>  On Fri, Apr 18, 2008 at 12:55 PM, Andrew Robinson
>
>
> <[EMAIL PROTECTED]> wrote:
>  > Perhaps matching the full agent string is a bad idea. I'd hate to have
>  >  to parse many variations of things like:
>  >
>  >  Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b5)
>  >  Gecko/2008032620 Firefox/3.0b5
>  >
>  >  -Andrew
>  >
>  >  On Fri, Apr 18, 2008 at 12:46 PM, Andrew Robinson
>  >
>  >
>  > <[EMAIL PROTECTED]> wrote:
>  >  > The problem already brought up is that minor version may not be
>  >  >  enough. In a 3 part version (ie 2.0.10) the minor of 0 isn't helpful
>  >  >  if you want to do something based on the 10 value
>  >  >
>  >  >  -Andrew
>  >  >
>  >  >
>  >  >
>  >  >  On Fri, Apr 18, 2008 at 12:40 PM, Matt Cooper <[EMAIL PROTECTED]> 
> wrote:
>  >  >  > Hi all,
>  >  >  >
>  >  >  >  The regex would be powerful though I'm afraid that it would not as
>  >  >  >  obvious or easy to use for non-technical designers/skinners.
>  >  >  >
>  >  >  >  I think something like this would be clearer:
>  >  >  >
>  >  >  >  @agent ie and (min-major-version: 6) and (min-minor-version: 1) and
>  >  >  >  (max-major-version: 6) {
>  >  >  >   /* styles for IE agent version 6.1 through 6.x (inclusive) */
>  >  >  >  }
>  >  >  >
>  >  >  >  Regards,
>  >  >  >  Matt
>  >  >  >
>  >  >  >  On Fri, Apr 18, 2008 at 12:30 PM, Andrew Robinson
>  >  >  >
>  >  >  >
>  >  >  > <[EMAIL PROTECTED]> wrote:
>  >  >  >  > Well that is difficult isn't it? Perhaps what I suggested a long 
> time
>  >  >  >  >  back in my bug is best and allow regexp:
>  >  >  >  >
>  >  >  >  >  @agent blah and (matches-version: /someRegExp/)
>  >  >  >  >
>  >  >  >  >  example to match 6.x through 7.x:
>  >  >  >  >  @agent ie and (matches-version: /[67](\.\d)*/)
>  >  >  >  >
>  >  >  >  >  yeah it is harder to write, but then we can write it once and it
>  >  >  >  >  handles pretty much all use cases.
>  >  >  >  >
>  >  >  >  >  The other twist is to give the code entire user agent string:
>  >  >  >  >
>  >  >  >  >  @agent matches(/MSIE\s+[67]/)
>  >  >  >  >
>  >  >  >  >  This really gives the user all the control they need and it is 
> pretty
>  >  >  >  >  easy to parse without having to code many syntax improvements 
> over
>  >  >  >  >  time as new requirements come up.
>  >  >  >  >
>  >  >  >  >  -Andrew
>  >  >  >  >
>  >  >  >  >  On Fri, Apr 18, 2008 at 12:10 PM, Andy Schwartz
>  >  >  >  >
>  >  >  >  > <[EMAIL PROTECTED]> wrote:
>  >  >  >  >
>  >  >  >  >
>  >  >  >  > > On Thu, Apr 17, 2008 at 9:21 PM, Andrew Robinson
>  >  >  >  >  >
>  >  >  >  >  > <[EMAIL PROTECTED]> wrote:
>  >  >  >  >  >
>  >  >  >  >  > > I'll be happy either way, but I think I now bend to the below
>  >  >  >  >  >  >  explanation of 5 == 5.0 from Jeanne's reasoning
>  >  >  >  >  >
>  >  >  >  >  >  FWIW, I actually agree with Jeanne's first opinion. :-)
>  >  >  >  >  >
>  >  >  >  >  >  That is, I think of "5" as "5.*".  "5.0" as "5.0.*", etc.
>  >  >  >  >  >
>  >  >  >  >  >  Regarding the use of floating points to represent versions... 
>  I was
>  >  >  >  >  >  wondering whether we should avoid this since it would 
> prevents us from
>  >  >  >  >  >  supporting "major.minor.reallyminor" version strings.  I 
> don't know
>  >  >  >  >  >  that we will ever need to go further than major.minor, though 
> the
>  >  >  >  >  >  Gecko versions use the third digit, so perhaps we should pick 
> a
>  >  >  >  >  >  solution that doesn't preclude us from supporting this?
>  >  >  >  >  >
>  >  >  >  >  >  (BTW, sorry all about my little digression earlier on the 
> thread...)
>  >  >  >  >  >
>  >  >  >  >  >  Andy
>  >  >  >  >  >
>  >  >  >  >
>  >  >  >
>  >  >
>  >
>

Reply via email to