-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/antlr-support' of github.com:specs-feup/anyweav…
…er into feature/antlr-support
- Loading branch information
Showing
7 changed files
with
118 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
GenericAnyNode: STREAM::store: {args=[outputStream], id=node::1, type=STREAM::store} | ||
GenericAnyNode: OP::+: {id=node::2, type=OP::+} | ||
GenericAnyNode: STREAM::load: {args=[S2], id=node::3, type=STREAM::load} | ||
GenericAnyNode: OP::*: {id=node::4, type=OP::*} | ||
GenericAnyNode: STREAM::load: {args=[S1], id=node::5, type=STREAM::load} | ||
GenericAnyNode: INPUT::VALUE: {args=[mult_factor], id=node::6, type=INPUT::VALUE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
laraImport("weaver.Query"); | ||
|
||
for (const l of Query.search("STREAM::load")) { | ||
console.log(l.getValue("args")); | ||
} | ||
|
||
console.log("Hello") |
30 changes: 30 additions & 0 deletions
30
AnyWeaver/test-resources/anyweaver/test/weaver/src/srl-ast.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"node::1": { | ||
"type": "STREAM::store", | ||
"args": ["outputStream"], | ||
"children": ["node::2"] | ||
}, | ||
"node::2": { | ||
"type": "OP::+", | ||
"children": ["node::3", "node::4"] | ||
}, | ||
"node::3": { | ||
"type": "STREAM::load", | ||
"args": ["S2"], | ||
"children": [] | ||
}, | ||
"node::4": { | ||
"type": "OP::*", | ||
"children": ["node::5", "node::6"] | ||
}, | ||
"node::5": { | ||
"type": "STREAM::load", | ||
"args": ["S1"], | ||
"children": [] | ||
}, | ||
"node::6": { | ||
"type": "INPUT::VALUE", | ||
"args": ["mult_factor"], | ||
"children": [] | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
AnyWeaver/test/pt/up/fe/specs/anycompiler/weaver/AnyWeaverTester.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package pt.up.fe.specs.anycompiler.weaver; | ||
|
||
|
||
import org.lara.interpreter.tester.WeaverTester; | ||
|
||
public class AnyWeaverTester extends WeaverTester<AnyWeaver, AnyWeaverTester> { | ||
|
||
public AnyWeaverTester(String basePackage) { | ||
super(AnyWeaver.class, basePackage); | ||
|
||
// Set custom settings | ||
//getCustomData(). | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
AnyWeaver/test/pt/up/fe/specs/anycompiler/weaver/tests/AnyWeaverTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright 2016 SPeCS. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. under the License. | ||
*/ | ||
|
||
package pt.up.fe.specs.anycompiler.weaver.tests; | ||
|
||
import org.junit.After; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
import pt.up.fe.specs.anycompiler.weaver.AnyWeaverTester; | ||
import pt.up.fe.specs.util.SpecsSystem; | ||
|
||
public class AnyWeaverTest { | ||
|
||
@BeforeClass | ||
public static void setupOnce() { | ||
SpecsSystem.programStandardInit(); | ||
AnyWeaverTester.clean(); | ||
} | ||
|
||
@After | ||
public void tearDown() { | ||
AnyWeaverTester.clean(); | ||
} | ||
|
||
private static AnyWeaverTester newTester() { | ||
return new AnyWeaverTester("anyweaver/test/weaver/") | ||
.setSrcPackage("src/") | ||
.setResultPackage("results/"); | ||
} | ||
|
||
@Test | ||
public void testBasic() { | ||
newTester().test("Srl.js", "srl-ast.json"); | ||
} | ||
|
||
|
||
} |