Skip to content

Commit

Permalink
Merge branch 'develop' into master for 0.1.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexLandau committed Jun 13, 2015
2 parents 463a24c + 33887ad commit 7397256
Show file tree
Hide file tree
Showing 16 changed files with 213 additions and 82 deletions.
2 changes: 1 addition & 1 deletion net.alloyggp.griddle/.classpath
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="validation-0.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="java-cup-11b-runtime.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="validation-0.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
4 changes: 2 additions & 2 deletions net.alloyggp.griddle/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Griddle
Bundle-SymbolicName: net.alloyggp.griddle;singleton:=true
Bundle-Version: 0.1.0.qualifier
Bundle-Version: 0.1.1.qualifier
Bundle-Activator: net.alloyggp.griddle.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Expand All @@ -11,6 +11,6 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.resources;bundle-version="3.9.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: validation-0.1.jar,
Bundle-ClassPath: validation-0.1.1.jar,
java-cup-11b-runtime.jar,
.
4 changes: 2 additions & 2 deletions net.alloyggp.griddle/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ bin.includes = plugin.xml,\
META-INF/,\
.,\
icons/,\
validation-0.1.jar,\
java-cup-11b-runtime.jar
java-cup-11b-runtime.jar,\
validation-0.1.1.jar
jars.compile.order = .
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class GdlScanner extends RuleBasedScanner {

public GdlScanner(ColorManager manager) {
IToken comment = createToken(GdlColorConstants.COMMENT, manager);
IToken implies = createToken(GdlColorConstants.DATALOG, manager);
IToken datalog = createToken(GdlColorConstants.DATALOG, manager);
IToken keyword = createToken(GdlColorConstants.KEYWORD, manager);
IToken variable = createToken(GdlColorConstants.VARIABLE, manager);
IToken normal = createToken(GdlColorConstants.DEFAULT, manager);
Expand All @@ -34,9 +34,10 @@ public GdlScanner(ColorManager manager) {
rules.add(new WordRule(new VariableWordDetector(), variable));

WordRule wordRule = new WordRule(new NormalWordDetector(), normal, true);
wordRule.addWord("<=", implies);
wordRule.addWord("or", implies);
wordRule.addWord("distinct", implies);
wordRule.addWord("<=", datalog);
wordRule.addWord("or", datalog);
wordRule.addWord("distinct", datalog);
wordRule.addWord("not", datalog);
wordRule.addWord("true", keyword);
wordRule.addWord("init", keyword);
wordRule.addWord("next", keyword);
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion validation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'eclipse'
sourceCompatibility = 1.6
targetCompatibility = '1.6'

version = '0.1'
version = '0.1.1'

repositories {
mavenCentral()
Expand Down
6 changes: 6 additions & 0 deletions validation/schemas/GdlParser.cup
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ termlist ::= termlist:ts term:t {: ts.add(t); RESULT = ts; :}
term ::= CONSTANT:c {: RESULT = Term.createConstant(c, cxleft, cxright); :}
| VARIABLE:v {: RESULT = Term.createVariable(v, vxleft, vxright); :}
| function:f {: RESULT = Term.createFunction(f, fxleft, fxright); :}
/* The following only apply for error cases where one of these Datalog keywords is being
used out of place. */
| IMPLIES:i {: RESULT = Term.createConstant("<=", ixleft, ixright); :}
| DISTINCT:d {: RESULT = Term.createConstant("distinct", dxleft, dxright); :}
| OR:o {: RESULT = Term.createConstant("or", oxleft, oxright); :}
| NOT:n {: RESULT = Term.createConstant("not", nxleft, nxright); :}
;
function ::= POPEN:pl CONSTANT:c termlist:ts PCLOSE:pr {: RESULT = Function.create(c, cxleft, cxright, ts, plxleft, prxright); :}
;
15 changes: 4 additions & 11 deletions validation/schemas/GdlScanner.flex
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,17 @@ import java_cup.runtime.Symbol;
%caseless

%{
/*private Symbol symbol(int type) {
return new Symbol(type, zzStartRead, zzMarkedPos);
}
private Symbol symbol(int type, Object value) {
return new Symbol(type, zzStartRead, zzMarkedPos, value);
}*/

private Symbol symbol(int type) {
int length = zzMarkedPos - zzStartRead;
return new ComplexSymbolFactory.ComplexSymbol("", type,
new Location(yyline, yycolumn, zzStartRead),
new Location(yyline, yycolumn + length, zzMarkedPos));
new Location(yyline, yycolumn, yychar),
new Location(yyline, yycolumn + length, yychar + length));
}
private Symbol symbol(int type, Object value) {
int length = zzMarkedPos - zzStartRead;
return new ComplexSymbolFactory.ComplexSymbol("", type,
new Location(yyline, yycolumn, zzStartRead),
new Location(yyline, yycolumn + length, zzMarkedPos), value);
new Location(yyline, yycolumn, yychar),
new Location(yyline, yycolumn + length, yychar + length), value);
}
%}

Expand Down
141 changes: 102 additions & 39 deletions validation/src/main/java/net/alloyggp/griddle/generated/GdlParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ public final Class getSymbolContainer() {
/** Production table. */
protected static final short _production_table[][] =
unpackFromStrings(new String[] {
"\000\024\000\002\002\004\000\002\002\004\000\002\002" +
"\000\030\000\002\002\004\000\002\002\004\000\002\002" +
"\002\000\002\003\003\000\002\003\003\000\002\004\007" +
"\000\002\005\003\000\002\005\006\000\002\006\004\000" +
"\002\006\002\000\002\007\003\000\002\007\006\000\002" +
"\007\007\000\002\007\006\000\002\010\004\000\002\010" +
"\002\000\002\011\003\000\002\011\003\000\002\011\003" +
"\000\002\012\006" });
"\000\002\011\003\000\002\011\003\000\002\011\003\000" +
"\002\011\003\000\002\012\006" });

/** Access to production table. */
@Override
Expand All @@ -55,35 +56,48 @@ public final Class getSymbolContainer() {
/** Parse-action table. */
protected static final short[][] _action_table =
unpackFromStrings(new String[] {
"\000\045\000\010\002\uffff\005\uffff\012\uffff\001\002\000" +
"\000\051\000\010\002\uffff\005\uffff\012\uffff\001\002\000" +
"\010\002\012\005\006\012\005\001\002\000\012\002\ufffb" +
"\005\ufffb\006\ufffb\012\ufffb\001\002\000\006\004\013\012" +
"\014\001\002\000\010\002\001\005\001\012\001\001\002" +
"\000\010\002\ufffd\005\ufffd\012\ufffd\001\002\000\010\002" +
"\ufffe\005\ufffe\012\ufffe\001\002\000\004\002\000\001\002" +
"\000\006\005\027\012\005\001\002\000\012\005\ufff2\006" +
"\ufff2\012\ufff2\013\ufff2\001\002\000\012\005\021\006\022" +
"\012\017\013\023\001\002\000\012\005\uffef\006\uffef\012" +
"\uffef\013\uffef\001\002\000\012\005\ufff1\006\ufff1\012\ufff1" +
"\013\ufff1\001\002\000\012\005\ufff3\006\ufff3\012\ufff3\013" +
"\ufff3\001\002\000\004\012\024\001\002\000\012\002\ufffa" +
"\005\ufffa\006\ufffa\012\ufffa\001\002\000\012\005\ufff0\006" +
"\ufff0\012\ufff0\013\ufff0\001\002\000\012\005\ufff2\006\ufff2" +
"\012\ufff2\013\ufff2\001\002\000\012\005\021\006\026\012" +
"\017\013\023\001\002\000\012\005\uffee\006\uffee\012\uffee" +
"\013\uffee\001\002\000\004\012\014\001\002\000\010\005" +
"\ufff8\006\ufff8\012\ufff8\001\002\000\010\005\032\006\035" +
"\012\005\001\002\000\012\007\036\010\040\011\037\012" +
"\014\001\002\000\010\005\ufff9\006\ufff9\012\ufff9\001\002" +
"\000\010\005\ufff7\006\ufff7\012\ufff7\001\002\000\010\002" +
"\ufffc\005\ufffc\012\ufffc\001\002\000\010\005\021\012\017" +
"\013\023\001\002\000\006\005\032\012\005\001\002\000" +
"\010\005\ufff8\006\ufff8\012\ufff8\001\002\000\010\005\032" +
"\006\042\012\005\001\002\000\010\005\ufff4\006\ufff4\012" +
"\ufff4\001\002\000\004\006\044\001\002\000\010\005\ufff6" +
"\006\ufff6\012\ufff6\001\002\000\010\005\021\012\017\013" +
"\023\001\002\000\004\006\047\001\002\000\010\005\ufff5" +
"\006\ufff5\012\ufff5\001\002" });
"\000\006\005\033\012\005\001\002\000\022\004\ufff2\005" +
"\ufff2\006\ufff2\007\ufff2\010\ufff2\011\ufff2\012\ufff2\013\ufff2" +
"\001\002\000\022\004\025\005\021\006\017\007\024\010" +
"\027\011\026\012\016\013\023\001\002\000\022\004\ufff1" +
"\005\ufff1\006\ufff1\007\ufff1\010\ufff1\011\ufff1\012\ufff1\013" +
"\ufff1\001\002\000\012\002\ufffa\005\ufffa\006\ufffa\012\ufffa" +
"\001\002\000\022\004\ufff3\005\ufff3\006\ufff3\007\ufff3\010" +
"\ufff3\011\ufff3\012\ufff3\013\ufff3\001\002\000\004\012\030" +
"\001\002\000\022\004\uffef\005\uffef\006\uffef\007\uffef\010" +
"\uffef\011\uffef\012\uffef\013\uffef\001\002\000\022\004\ufff0" +
"\005\ufff0\006\ufff0\007\ufff0\010\ufff0\011\ufff0\012\ufff0\013" +
"\ufff0\001\002\000\022\004\uffed\005\uffed\006\uffed\007\uffed" +
"\010\uffed\011\uffed\012\uffed\013\uffed\001\002\000\022\004" +
"\uffee\005\uffee\006\uffee\007\uffee\010\uffee\011\uffee\012\uffee" +
"\013\uffee\001\002\000\022\004\uffeb\005\uffeb\006\uffeb\007" +
"\uffeb\010\uffeb\011\uffeb\012\uffeb\013\uffeb\001\002\000\022" +
"\004\uffec\005\uffec\006\uffec\007\uffec\010\uffec\011\uffec\012" +
"\uffec\013\uffec\001\002\000\022\004\ufff2\005\ufff2\006\ufff2" +
"\007\ufff2\010\ufff2\011\ufff2\012\ufff2\013\ufff2\001\002\000" +
"\022\004\025\005\021\006\032\007\024\010\027\011\026" +
"\012\016\013\023\001\002\000\022\004\uffea\005\uffea\006" +
"\uffea\007\uffea\010\uffea\011\uffea\012\uffea\013\uffea\001\002" +
"\000\004\012\014\001\002\000\010\005\ufff8\006\ufff8\012" +
"\ufff8\001\002\000\010\005\036\006\041\012\005\001\002" +
"\000\012\007\042\010\044\011\043\012\014\001\002\000" +
"\010\005\ufff9\006\ufff9\012\ufff9\001\002\000\010\005\ufff7" +
"\006\ufff7\012\ufff7\001\002\000\010\002\ufffc\005\ufffc\012" +
"\ufffc\001\002\000\020\004\025\005\021\007\024\010\027" +
"\011\026\012\016\013\023\001\002\000\006\005\036\012" +
"\005\001\002\000\010\005\ufff8\006\ufff8\012\ufff8\001\002" +
"\000\010\005\036\006\046\012\005\001\002\000\010\005" +
"\ufff4\006\ufff4\012\ufff4\001\002\000\004\006\050\001\002" +
"\000\010\005\ufff6\006\ufff6\012\ufff6\001\002\000\020\004" +
"\025\005\021\007\024\010\027\011\026\012\016\013\023" +
"\001\002\000\004\006\053\001\002\000\010\005\ufff5\006" +
"\ufff5\012\ufff5\001\002" });

/** Access to parse-action table. */
@Override
Expand All @@ -92,22 +106,23 @@ public final Class getSymbolContainer() {
/** <code>reduce_goto</code> table. */
protected static final short[][] _reduce_table =
unpackFromStrings(new String[] {
"\000\045\000\004\002\003\001\001\000\010\003\006\004" +
"\000\051\000\004\002\003\001\001\000\010\003\006\004" +
"\010\005\007\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\004\005\027\001\001\000\004\010\014" +
"\001\001\000\006\011\017\012\015\001\001\000\002\001" +
"\002\001\001\000\004\005\033\001\001\000\004\010\014" +
"\001\001\000\006\011\017\012\021\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\004\010\024\001" +
"\001\000\006\011\017\012\015\001\001\000\002\001\001" +
"\000\002\001\001\000\004\006\030\001\001\000\006\005" +
"\033\007\032\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\006\011\044\012" +
"\015\001\001\000\006\005\033\007\042\001\001\000\004" +
"\006\040\001\001\000\006\005\033\007\032\001\001\000" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\004" +
"\010\030\001\001\000\006\011\017\012\021\001\001\000" +
"\002\001\001\000\002\001\001\000\004\006\034\001\001" +
"\000\006\005\037\007\036\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\006" +
"\011\045\012\015\001\001\000\002\001\001\000\002\001" +
"\001" });
"\011\050\012\021\001\001\000\006\005\037\007\046\001" +
"\001\000\004\006\044\001\001\000\006\005\037\007\036" +
"\001\001\000\002\001\001\000\002\001\001\000\002\001" +
"\001\000\006\011\051\012\021\001\001\000\002\001\001" +
"\000\002\001\001" });

/** Access to <code>reduce_goto</code> table. */
@Override
Expand Down Expand Up @@ -450,7 +465,55 @@ class CUP$GdlParser$actions {
return CUP$GdlParser$result;

/*. . . . . . . . . . . . . . . . . . . .*/
case 19: // function ::= POPEN CONSTANT termlist PCLOSE
case 19: // term ::= IMPLIES
{
Term RESULT =null;
Location ixleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$GdlParser$stack.peek()).xleft;
Location ixright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$GdlParser$stack.peek()).xright;
Object i = (Object)((java_cup.runtime.Symbol) CUP$GdlParser$stack.peek()).value;
RESULT = Term.createConstant("<=", ixleft, ixright);
CUP$GdlParser$result = parser.getSymbolFactory().newSymbol("term",7, ((java_cup.runtime.Symbol)CUP$GdlParser$stack.peek()), ((java_cup.runtime.Symbol)CUP$GdlParser$stack.peek()), RESULT);
}
return CUP$GdlParser$result;

/*. . . . . . . . . . . . . . . . . . . .*/
case 20: // term ::= DISTINCT
{
Term RESULT =null;
Location dxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$GdlParser$stack.peek()).xleft;
Location dxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$GdlParser$stack.peek()).xright;
Object d = (Object)((java_cup.runtime.Symbol) CUP$GdlParser$stack.peek()).value;
RESULT = Term.createConstant("distinct", dxleft, dxright);
CUP$GdlParser$result = parser.getSymbolFactory().newSymbol("term",7, ((java_cup.runtime.Symbol)CUP$GdlParser$stack.peek()), ((java_cup.runtime.Symbol)CUP$GdlParser$stack.peek()), RESULT);
}
return CUP$GdlParser$result;

/*. . . . . . . . . . . . . . . . . . . .*/
case 21: // term ::= OR
{
Term RESULT =null;
Location oxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$GdlParser$stack.peek()).xleft;
Location oxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$GdlParser$stack.peek()).xright;
Object o = (Object)((java_cup.runtime.Symbol) CUP$GdlParser$stack.peek()).value;
RESULT = Term.createConstant("or", oxleft, oxright);
CUP$GdlParser$result = parser.getSymbolFactory().newSymbol("term",7, ((java_cup.runtime.Symbol)CUP$GdlParser$stack.peek()), ((java_cup.runtime.Symbol)CUP$GdlParser$stack.peek()), RESULT);
}
return CUP$GdlParser$result;

/*. . . . . . . . . . . . . . . . . . . .*/
case 22: // term ::= NOT
{
Term RESULT =null;
Location nxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$GdlParser$stack.peek()).xleft;
Location nxright = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$GdlParser$stack.peek()).xright;
Object n = (Object)((java_cup.runtime.Symbol) CUP$GdlParser$stack.peek()).value;
RESULT = Term.createConstant("not", nxleft, nxright);
CUP$GdlParser$result = parser.getSymbolFactory().newSymbol("term",7, ((java_cup.runtime.Symbol)CUP$GdlParser$stack.peek()), ((java_cup.runtime.Symbol)CUP$GdlParser$stack.peek()), RESULT);
}
return CUP$GdlParser$result;

/*. . . . . . . . . . . . . . . . . . . .*/
case 23: // function ::= POPEN CONSTANT termlist PCLOSE
{
Function RESULT =null;
Location plxleft = ((java_cup.runtime.ComplexSymbolFactory.ComplexSymbol)CUP$GdlParser$stack.elementAt(CUP$GdlParser$top-3)).xleft;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
import net.alloyggp.griddle.validator.check.InitBaseInputAreConstantCheck;
import net.alloyggp.griddle.validator.check.InitNextBaseInputNotInRuleBodiesCheck;
import net.alloyggp.griddle.validator.check.KeywordArityCheck;
import net.alloyggp.griddle.validator.check.KeywordsAreSentenceNamesCheck;
import net.alloyggp.griddle.validator.check.KeywordsAreNotFunctionNamesCheck;
import net.alloyggp.griddle.validator.check.KeywordsAreNotObjectConstantsCheck;
import net.alloyggp.griddle.validator.check.NegationContainsSentenceCheck;
import net.alloyggp.griddle.validator.check.NoNegativeEdgesInCyclesCheck;
import net.alloyggp.griddle.validator.check.OriginalRecursionRestrictionCheck;
Expand Down Expand Up @@ -48,7 +49,8 @@ public static ValidatorConfiguration createStandard() {
checks.put(InitBaseInputAreConstantCheck.INSTANCE, Level.ERROR);
checks.put(InitNextBaseInputNotInRuleBodiesCheck.INSTANCE, Level.ERROR);
checks.put(KeywordArityCheck.INSTANCE, Level.ERROR);
checks.put(KeywordsAreSentenceNamesCheck.INSTANCE, Level.ERROR);
checks.put(KeywordsAreNotFunctionNamesCheck.INSTANCE, Level.ERROR);
checks.put(KeywordsAreNotObjectConstantsCheck.INSTANCE, Level.WARNING);
checks.put(NegationContainsSentenceCheck.INSTANCE, Level.ERROR);
checks.put(NoNegativeEdgesInCyclesCheck.INSTANCE, Level.ERROR);
checks.put(OriginalRecursionRestrictionCheck.INSTANCE, Level.ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public void findProblems(AnalyzedGame game, final ProblemReporter reporter) {
public void visitConstant(String constant, Position position) {
if (constant.equalsIgnoreCase("<=")
|| constant.equalsIgnoreCase("distinct")
|| constant.equalsIgnoreCase("or")) {
|| constant.equalsIgnoreCase("or")
|| constant.equalsIgnoreCase("not")) {
reporter.report(constant + " is a reserved Datalog keyword, and appears to be"
+ " used as a constant here. Check your syntax.", position);
}
Expand Down
Loading

0 comments on commit 7397256

Please sign in to comment.