[e-cvs] cvs commit: e/src/esrc/org/erights/e/tools/text first__quasiParser.emaker
markm@eros.cs.jhu.edu
markm@eros.cs.jhu.edu
Tue, 24 Jul 2001 07:46:32 -0400
markm 01/07/24 07:46:32
Added: src/esrc/org/erights/e/tools/text first__quasiParser.emaker
Log:
time now in ISO8601
Revision Changes Path
1.1 e/src/esrc/org/erights/e/tools/text/first__quasiParser.emaker
Index: first__quasiParser.emaker
===================================================================
def FirstCharSplitterMaker :=
<import:org.erights.e.elib.quasi.FirstCharSplitter>
# XXX should be proper hash-cache
def mmCache := [] asMap() diverge()
# A quasi-pattern-parser for splitting a string at the first occurrence of
# any of a set of characters
def first__quasiParser {
to matchMaker(template) :any {
def optResult := mmCache get(template, null)
if (optResult != null) {
optResult
} else {
# XXX special case for now
def `@@{0}[@specials]@@{1}` := template
def splitter := FirstCharSplitterMaker new(specials)
def FirstCharMatchMaker {
to matchBind([], specimen) :any {
def index := splitter findIn(specimen)
if (index == -1) {
null
} else {
[specimen(0, index), specimen(index, specimen size())]
}
}
}
}
}
}