
| Key: |
STR-26
|
| Type: |
Bug
|
| Status: |
Closed
|
| Resolution: |
Won't Fix
|
| Priority: |
Major
|
| Assignee: |
Unassigned
|
| Reporter: |
Arthur van Dam
|
| Votes: |
0
|
| Watchers: |
0
|
|
|
|
Original Estimate:
|
Unknown
|
Remaining Estimate:
|
Unknown
|
Time Spent:
|
Unknown
|
|
Environment:
|
strategoxt-r5522
|
|
|
The iter-n and iter-n-sep patterns in SDF cannot be imploded by implode-asfix.
Consider the following definition niter-test.sdf :
----
module niter-test
exports
sorts Foo Bar
lexical syntax
[\ \t\13\n] -> LAYOUT
"foo" -> Foo
context-free syntax
"(" {Foo ","}2+ ")" -> Bar {cons("TwoOrMore")}
"(" {Foo ","}+ ")" -> Bar {cons("OneOrMore")}
context-free restrictions
LAYOUT? -/- [\ \t\13\n]
context-free priorities
"(" {Foo ","}2+ ")" -> Bar
> "(" {Foo ","}+ ")" -> Bar
----
and an example file: test.nit
----
(foo, foo)
----
packing and table-generation goes fine, but when running
$ sglri -i test.nit -p niter-test.tbl | pp-aterm
or
$ sglr -i test.nit -p niter-test.tbl -2 | implode-asfix |
pp-aterm
the following output is produced:
----
TwoOrMore(
appl(
prod(
[ cf(sort("Foo"))
, cf(opt(layout))
, lit(",")
, cf(opt(layout))
, cf(iter-sep(sort("Foo"), lit(",")))
]
, cf(iter-sep-n(sort("Foo"), lit(","), 2))
, no-attrs
)
, ["foo", None, lit(","), Some(" "), ["foo"]]
)
)
----
When the 2+ production is left out, all parsing into the 'OneOrMore' constructor goes just fine. I also tried an 1+ pattern, but this is desugared into a normal + in some earlier stage.
And, as said: the above also fails for the iter-n (w/o separator)
|
|
Description
|
The iter-n and iter-n-sep patterns in SDF cannot be imploded by implode-asfix.
Consider the following definition niter-test.sdf :
----
module niter-test
exports
sorts Foo Bar
lexical syntax
[\ \t\13\n] -> LAYOUT
"foo" -> Foo
context-free syntax
"(" {Foo ","}2+ ")" -> Bar {cons("TwoOrMore")}
"(" {Foo ","}+ ")" -> Bar {cons("OneOrMore")}
context-free restrictions
LAYOUT? -/- [\ \t\13\n]
context-free priorities
"(" {Foo ","}2+ ")" -> Bar
> "(" {Foo ","}+ ")" -> Bar
----
and an example file: test.nit
----
(foo, foo)
----
packing and table-generation goes fine, but when running
$ sglri -i test.nit -p niter-test.tbl | pp-aterm
or
$ sglr -i test.nit -p niter-test.tbl -2 | implode-asfix |
pp-aterm
the following output is produced:
----
TwoOrMore(
appl(
prod(
[ cf(sort("Foo"))
, cf(opt(layout))
, lit(",")
, cf(opt(layout))
, cf(iter-sep(sort("Foo"), lit(",")))
]
, cf(iter-sep-n(sort("Foo"), lit(","), 2))
, no-attrs
)
, ["foo", None, lit(","), Some(" "), ["foo"]]
)
)
----
When the 2+ production is left out, all parsing into the 'OneOrMore' constructor goes just fine. I also tried an 1+ pattern, but this is desugared into a normal + in some earlier stage.
And, as said: the above also fails for the iter-n (w/o separator) |
Show » |
|
|
implode-lexical =
...
//<+ ?appl(prod(_,varsym(cf(iter-n(_))),_),_); !meta-listvar(<yield>)
//<+ ?appl(prod(_,varsym(cf(iter-sep-n(_,_))),_),_); !meta-listvar(<yield>)
Both lines were introduced 18 months ago by Eelco (lines 237-238, see:
http://cvs.cs.uu.nl/cgi-bin/cvsweb.cgi/XT-OLD/asfix-tools/src/implode/implode-asfix.r?annotate=1.13 ), but they have always been commented, I don't know the reason for that.