STR-709: sdf ast attributes: support annotations in ast patterns
Example:
—————————————————–
definition
module Main
exports
context-free start-symbols Exprcontext-free syntax A B C -> Expr {ast("Foo(<1>, <2>, <3>)")} B C -> Expr {ast("Foo(<1>){<2>}")} B C D -> Expr {ast("Foo(<1>){<2>, <3>}")} C D -> Expr {ast("Foo(<1>){Id(<2>)}")} D E -> Expr {ast("<1>{<2>}")}
lexical syntax
“a” -> A
“b” -> B
“c” -> C
“d” -> D
“e” -> E[
] -> LAYOUT
—————————————————–Testsuite:
—————————————————–
testsuite Ast attributes and annotations
topsort Exprtest
“a b c” -> Foo(“a”, “b”, “c”)test
“b c” -> Foo(“b”){“c”}test
“b c d” -> Foo(“b”){“c”, “d”}test
“c d” -> Foo(“c”){Id(“d”)}test
“d e” -> “d”{“e”}
—————————————————–Output:
Submitted on 20 March 2007 at 16:10
———————————————————————–
executing testsuite Ast attributes and annotations with 5 tests
———————————————————————–
* OK : test 1 (a b c)
* ERROR: test 2 (b c)
- succeeded: Foo(“b”)
- expected: Foo(“b”){“c”}
* ERROR: test 3 (b c d)
- succeeded: Foo(“b”)
- expected: Foo(“b”){“c”,“d”}
* ERROR: test 4 (c d)
- succeeded: Foo(“c”)
- expected: Foo(“c”){Id(“d”)}
* ERROR: test 5 (d e)
- succeeded: “d”
- expected: “d”{“e”}
———————————————————————–
results testsuite Ast attributes and annotations
successes : 1
failures : 4
———————————————————————–
Log in to post comments