Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add meta variables to SDF3 Stratego mix syntax test #65

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add failing test with Conc
  • Loading branch information
Apanatshka committed Apr 5, 2022
commit 76fd71b2a5bab0a1302464d81c5efd2e2457c802
11 changes: 6 additions & 5 deletions org.metaborg.sdf3.meta.integrationtest/editor/Main.esv
Original file line number Diff line number Diff line change
@@ -13,8 +13,9 @@ menus

menu: "Transform"

action: "Swap exps (abstract syntax)" = editor-action-swap-exps-abstract-syntax (source)
action: "Swap exps (concrete syntax)" = editor-action-swap-exps-concrete-syntax (source)
action: "Swap exps (concrete syntax simple)" = editor-action-swap-exps-concrete-syntax-simple (source)
action: "Swap exps (concrete syntax var)" = editor-action-swap-exps-concrete-syntax-var (source)
action: "Reverse stmts (concrete syntax varlist)" = editor-action-reverse-stmts-concrete-syntax-varlist (source)
action: "Swap exps (abstract syntax)" = editor-action-swap-exps-abstract-syntax (source)
action: "Swap exps (concrete syntax)" = editor-action-swap-exps-concrete-syntax (source)
action: "Swap exps (concrete syntax simple)" = editor-action-swap-exps-concrete-syntax-simple (source)
action: "Swap exps (concrete syntax var)" = editor-action-swap-exps-concrete-syntax-var (source)
action: "Reverse stmts (concrete syntax varlist)" = editor-action-reverse-stmts-concrete-syntax-varlist (source)
action: "Surround stmts (concrete syntax varlist)" = editor-action-surround-stmts-concrete-syntax-varlist (source)
7 changes: 6 additions & 1 deletion org.metaborg.sdf3.meta.integrationtest/test/swap.spt
Original file line number Diff line number Diff line change
@@ -12,4 +12,9 @@ test swap [[x + y;]] transform "Transform -> Swap exps (concrete syntax simple)"

test swap [[x + y;]] transform "Transform -> Swap exps (concrete syntax var)" to [[y + x;]]

test swap [[x; y;]] transform "Transform -> Reverse stmts (concrete syntax varlist)" to [[y; x;]]
test swap [[x; y;]] transform "Transform -> Reverse stmts (concrete syntax varlist)" to [[y; x;]]

// This test will fail due to broken Conc generation, not sure why yet
test swap [[x; y;]] transform "Transform -> Surround stmts (concrete syntax varlist)" to [[
//a;
x; y; a;]]
19 changes: 13 additions & 6 deletions org.metaborg.sdf3.meta.integrationtest/trans/swap.str
Original file line number Diff line number Diff line change
@@ -7,11 +7,12 @@ imports

rules

editor-action-swap-exps-abstract-syntax = editor-action(swap-exps-abstract-syntax)
editor-action-swap-exps-concrete-syntax = editor-action(swap-exps-concrete-syntax)
editor-action-swap-exps-concrete-syntax-simple = editor-action(swap-exps-concrete-syntax-simple)
editor-action-swap-exps-concrete-syntax-var = editor-action(swap-exps-concrete-syntax-var)
editor-action-reverse-stmts-concrete-syntax-varlist = editor-action(reverse-stmts-concrete-syntax-varlist)
editor-action-swap-exps-abstract-syntax = editor-action(swap-exps-abstract-syntax)
editor-action-swap-exps-concrete-syntax = editor-action(swap-exps-concrete-syntax)
editor-action-swap-exps-concrete-syntax-simple = editor-action(swap-exps-concrete-syntax-simple)
editor-action-swap-exps-concrete-syntax-var = editor-action(swap-exps-concrete-syntax-var)
editor-action-reverse-stmts-concrete-syntax-varlist = editor-action(reverse-stmts-concrete-syntax-varlist)
editor-action-surround-stmts-concrete-syntax-varlist = editor-action(surround-stmts-concrete-syntax-varlist)

editor-action(s):
(_, _, ast, path, _) -> (path, <topdown(try(s))> ast)
@@ -34,4 +35,10 @@ rules
reverse-stmts-concrete-syntax-varlist:
|[ stmt1* ]| ->
|[ stmt2* ]|
where stmt2* := <reverse> stmt1*
where stmt2* := <reverse> stmt1*

surround-stmts-concrete-syntax-varlist:
|[ stmt1* ]| ->
program |[ //a; // adding anything before the meta-listvar breaks parsing
stmt1*
a; ]|