projects
/
sbp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
062890b
)
add first-class zero-or-more repetitions
author
adam
<adam@megacz.com>
Sun, 9 Sep 2007 19:13:05 +0000
(15:13 -0400)
committer
adam
<adam@megacz.com>
Sun, 9 Sep 2007 19:13:05 +0000
(15:13 -0400)
darcs-hash:
20070909191305
-5007d-
927c136b9357a9190011710203e80e6258c66720
.gz
src/edu/berkeley/sbp/meta/Repeat.java
patch
|
blob
|
history
diff --git
a/src/edu/berkeley/sbp/meta/Repeat.java
b/src/edu/berkeley/sbp/meta/Repeat.java
index
a97eb38
..
800639b
100644
(file)
--- a/
src/edu/berkeley/sbp/meta/Repeat.java
+++ b/
src/edu/berkeley/sbp/meta/Repeat.java
@@
-41,9
+41,12
@@
class Repeat extends Union {
add(Sequence.create(tag, new Element[] { }, null).followedBy(follow));
if (!(zeroOkay && manyOkay))
add(Sequence.create(tag, new Element[] { e }, null).followedBy(follow));
add(Sequence.create(tag, new Element[] { }, null).followedBy(follow));
if (!(zeroOkay && manyOkay))
add(Sequence.create(tag, new Element[] { e }, null).followedBy(follow));
- if (zeroOkay && manyOkay)
+
+ // FEATURE: stringify ~[]* as ...
+ if (zeroOkay && manyOkay && separator!=null) {
add(Sequence.create(many1(e, separator, tag)).followedBy(follow));
add(Sequence.create(many1(e, separator, tag)).followedBy(follow));
- if (!zeroOkay && manyOkay) {
+
+ } else if (manyOkay) {
if (separator==null)
add(Sequence.create(tag,
new Element[] { Repeat.this, e },
if (separator==null)
add(Sequence.create(tag,
new Element[] { Repeat.this, e },