-
Notifications
You must be signed in to change notification settings - Fork 160
imports FOO.bar
#2144
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
Merged
Merged
imports FOO.bar
#2144
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b038f77
fix import toString
ed65956
kil for partial import
4d2c83a
kore class for partial import
021aa51
partial import toString
43fb3b4
partial import FlatImport
78baff4
fix Import constructors
0d6bb5e
scala java converters for Option/Optional
af27500
fix import constructors
4539f1d
fix json parser/unparser
6188a6b
fix kiltokore
9b7994d
fix outer parser
d028c2f
implement signature function for partial imports
97a3593
fix ToJson
6853549
Merge branch 'master' into import3
472687a
break long lines
6f1173a
add failing test
8d0c439
add passing test
e9c9371
add outer parsing test
470a7a8
documentation
e9da969
fix whitespace
f31c4cd
fix typo
6e84f99
More elaborate failing test.
radumereuta d32609c
Merge branch 'master' into import3
rv-jenkins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
27 changes: 27 additions & 0 deletions
27
k-distribution/tests/regression-new/checks/partialImport.k
This file contains hidden or 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,27 @@ | ||
| module PARTIALIMPORT | ||
| imports A | ||
| imports D | ||
|
|
||
| rule foo() => .K | ||
| rule bar() => .K | ||
| rule alsoAFoo() => .K | ||
| rule boo() => .K | ||
| endmodule | ||
|
|
||
| module A | ||
| imports B.foo | ||
| endmodule | ||
|
|
||
| module B | ||
| imports C | ||
| syntax Foo ::= foo() | ||
| syntax Bar ::= bar() | ||
| endmodule | ||
|
|
||
| module C | ||
| syntax Foo ::= alsoAFoo() [foo] | ||
| endmodule | ||
|
|
||
| module D [private] | ||
| syntax Boo ::= boo() | ||
| endmodule | ||
7 changes: 7 additions & 0 deletions
7
k-distribution/tests/regression-new/checks/partialImport.k.out
This file contains hidden or 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 @@ | ||
| [Error] Inner Parser: Parse error: unexpected token ')'. | ||
| Source(partialImport.k) | ||
| Location(6,12,6,13) | ||
| [Error] Inner Parser: Parse error: unexpected token ')'. | ||
| Source(partialImport.k) | ||
| Location(8,12,8,13) | ||
| [Error] Compiler: Had 2 parsing errors. |
This file contains hidden or 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 @@ | ||
| DEF=test | ||
| EXT=test | ||
| TESTDIR=. | ||
| KOMPILE_BACKEND=llvm | ||
| KOMPILE_FLAGS=--syntax-module TEST | ||
|
|
||
| include ../../../include/kframework/ktest.mak |
This file contains hidden or 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,20 @@ | ||
| module TEST | ||
| imports A | ||
|
|
||
| rule foo() => .K | ||
| rule alsoAFoo() => .K | ||
| endmodule | ||
|
|
||
| module A | ||
| imports B.foo | ||
| endmodule | ||
|
|
||
| module B | ||
| imports C | ||
| syntax Foo ::= foo() | ||
| syntax Bar ::= bar() | ||
| endmodule | ||
|
|
||
| module C | ||
| syntax Foo ::= alsoAFoo() [foo] | ||
| endmodule |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
73 changes: 73 additions & 0 deletions
73
kernel/src/test/java/org/kframework/parser/outer/OuterParsingTest.java
This file contains hidden or 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,73 @@ | ||
| // Copyright (c) 2014-2019 K Team. All Rights Reserved. | ||
| package org.kframework.parser.outer; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import junit.framework.Assert; | ||
|
|
||
| import org.junit.Test; | ||
| import org.kframework.attributes.Source; | ||
| import org.kframework.kil.DefinitionItem; | ||
| import org.kframework.kil.Import; | ||
| import org.kframework.kil.Module; | ||
| import org.kframework.kil.StringSentence; | ||
|
|
||
| public class OuterParsingTest { | ||
|
|
||
| @Test | ||
| public void testEmptyRules() { | ||
| String def = "module TEST rule endmodule"; | ||
|
|
||
| List<DefinitionItem> defItemList = Outer.parse(Source.apply("generated by OuterParsingTests"), def, null); | ||
| Assert.assertEquals(1, defItemList.size()); | ||
|
|
||
| Module mod = (Module) defItemList.get(0); | ||
| Assert.assertEquals(1, mod.getItems().size()); | ||
| StringSentence sen = (StringSentence) mod.getItems().get(0); | ||
| Assert.assertEquals(sen.getContent(), ""); | ||
| } | ||
|
|
||
| @Test | ||
| public void testClaimKeyword() throws Exception { | ||
| String def = "module TEST claim X => Y endmodule"; | ||
|
|
||
| List<DefinitionItem> defItemList = Outer.parse(Source.apply("generated by OuterParsingTests"), def, null); | ||
| Assert.assertEquals(1, defItemList.size()); | ||
|
|
||
| Module mod = (Module) defItemList.get(0); | ||
| Assert.assertEquals(1, mod.getItems().size()); | ||
| StringSentence sen = (StringSentence) mod.getItems().get(0); | ||
| Assert.assertEquals(sen.getContent(), "X => Y"); | ||
| Assert.assertEquals(sen.getType(), "claim"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testImport() { | ||
| String def = "module A endmodule module TEST imports A imports private A imports public A imports A.foo endmodule"; | ||
|
|
||
| List<DefinitionItem> defItemList = Outer.parse(Source.apply("generated by OuterParsingTestes"), def, null); | ||
| Assert.assertEquals(2, defItemList.size()); | ||
|
|
||
| Module a = (Module) defItemList.get(0); | ||
| Assert.assertEquals(0, a.getItems().size()); | ||
|
|
||
| Module mod = (Module) defItemList.get(1); | ||
| Assert.assertEquals(4, mod.getItems().size()); | ||
|
|
||
| Import sen = (Import) mod.getItems().get(0); | ||
| Assert.assertEquals(true, sen.isPublic()); | ||
| Assert.assertEquals(null, sen.getTag()); | ||
|
|
||
| sen = (Import) mod.getItems().get(1); | ||
| Assert.assertEquals(false, sen.isPublic()); | ||
| Assert.assertEquals(null, sen.getTag()); | ||
|
|
||
| sen = (Import) mod.getItems().get(2); | ||
| Assert.assertEquals(true, sen.isPublic()); | ||
| Assert.assertEquals(null, sen.getTag()); | ||
|
|
||
| sen = (Import) mod.getItems().get(3); | ||
| Assert.assertEquals(true, sen.isPublic()); | ||
| Assert.assertEquals("foo", sen.getTag()); | ||
| } | ||
| } |
38 changes: 0 additions & 38 deletions
38
kernel/src/test/java/org/kframework/parser/outer/OuterParsingTests.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.