[Scummvm-devel] SaveFileManager::listSavefiles()

Marcus Comstedt marcus at mc.pp.se
Thu Sep 20 12:50:28 CEST 2007


Max Horn <max at quendi.de> writes:

> Long answer: It expect a "regular expression", which, in the language  
> of a computer scientists, usually consists of only * and ?, and hence  
> corresponds what you call a "glob".

In the language of a computer scientist who flunked his courses
perhaps.  A glob is _not_ a regular expression.  Syntactic issues
aside, the expressiveness of globs are not equal to the set of
regular languages.  Proof:  "zero or more a:s" (regular expression
"a*") is a regular language.  However, it can not be expressed as a
glob.  (This is because globs provide no repetition construct which
allows the language matching the repetition to be limited in any way.)


> It is *not*, however, what I  
> would call an "extended regular expression", such as tools as "grep"  
> expect. Of course, in day-to-day "hacker language", the term "regex"  
> is often used not to refer to "regular expressions" in the original  
> sense, but rather to all sorts of extension, even some which are not  
> "regular expressions" anymore (i.e. anything which allows  
> backreferences or some other kind of "memory").

Extended or not, globs and regexps are different.  Even if you
restrict your regular expressions to only the metacharacters ? and *,
the semantics differ from globs.

Expression        Meaning as regexp         Meaning as glob
a?                Zero or one "a"           "a" followed by any char
a*                Zero or more "a":s        "a" followed by any string

So for example "ab?c" interpreted as a regexp matches "a" and "ac" and
nothing more.  Interpreted as a glob it matches none of these strings,
but instead "abxc", "abyc" etc.


> Relax, no need to overreact, there is quite a difference between  
> "needs some enhancements" and "useless", isn't there? ;-)

Being useless and being unfixable isn't the same thing.  But as long
as there is no way of knowing what input the function should have,
there's no way to call it in a way that produces the desired result,
and so it is useless.  Once properly specified, it becomes useful
again.


> Anyway, quick answer: only * and ? need to be supported. We'll fix  
> the doc string.

That's half the problem solved, but it still needs to be properly
specified if it's regexp "*" and "?" or glob "*" and "?" (see above).


  // Marcus






More information about the Scummvm-devel mailing list