|
|
@@ -2,8 +2,8 @@ |
|
|
--
|
|
|
-- NOTE: This schema is currently unused. It would be useful for parsing
|
|
|
-- and translating globs to Python's regex engine, which supports non-greedy
|
|
|
-- matches. But we don't want to depend on Python regexes, so we use a
|
|
|
-- quadratic loop like bash/mksh. This is unfortunate, but strings are
|
|
|
-- matches. But we don't want to depend on Python regexes, so we use a
|
|
|
-- quadratic loop like bash/mksh. This is unfortunate, but strings are
|
|
|
-- generally short.
|
|
|
--
|
|
|
-- The schema could still be used for some kind of automatic glob translation.
|
|
|
@@ -19,20 +19,12 @@ module glob { |
|
|
|
|
|
glob = (glob_part* parts)
|
|
|
|
|
|
-- Example: *.[ch] is Star, Literal('.'), CharClass(False, ...)
|
|
|
glob_part =
|
|
|
Literal(string s)
|
|
|
| EscapedChar(string c) -- \* \? \[
|
|
|
| Star -- * is 0 or more characters, like the regex .*
|
|
|
-- Example: *.[ch] is Star, Literal('.'), CharClassExpr(False, 'ch')
|
|
|
glob_part =
|
|
|
Literal(string s)
|
|
|
| Star -- * is 0 or more characters, like the regex .*
|
|
|
| QMark -- ? is a single character
|
|
|
| BracketExpr(bool negated, char_clause* clauses)
|
|
|
|
|
|
char_clause =
|
|
|
LiteralChar(string c)
|
|
|
-- NOTE: Name conflict with above. Should be namespaced.
|
|
|
| EscapedChar2(string c) -- \! \-
|
|
|
| CharRange(string begin, string end) -- a-z 0-9
|
|
|
| CharClass(string name) -- [:alpha:]
|
|
|
| CharClassExpr(bool negated, string body)
|
|
|
|
|
|
-- TODO:
|
|
|
-- * Collating symbols are [. .]
|
|
|
|