Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/compile/Grouping.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private void createGroup(List<Instruction> insts) {
if (inst.getKind() == Instruction.COMMIT || inst.getKind() == Instruction.JUMP) break;
Integer group = null;
Integer changegroup = null;
ArrayList list = inst.getVarArgs(new HashMap());
ArrayList list = inst.getVarArgs(new HashMap<>());
if (list.isEmpty()) continue;
for (int j = 0; j < list.size(); j++) {
if (list.get(j).equals(0)) continue;
Expand Down
7 changes: 4 additions & 3 deletions src/compile/GuardCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,11 @@ else if (true) {
hlgroundAttrs.put(def1, attrAtoms);
// System.out.println("#hlgroundAttrs: " + hlgroundAttrs.get(def1).length);
checktypedefLink(func, def1);
} else {
error("COMPILE ERROR: unrecognized type constraint: " + cstr);
discardTypeConstraint(cstr); // ここには来ない
}
// else {
// error("COMPILE ERROR: unrecognized type constraint: " + cstr);
// discardTypeConstraint(cstr); // ここには来ない
// }
lit.remove();
changed = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/compile/RuleCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ private void fixUniqOrder() {

/** 否定条件をコンパイルする */
void compileNegatives() {
Iterator<List<ProcessContextEquation>> it = rs.guardNegatives.iterator();
Iterator<LinkedList<ProcessContextEquation>> it = rs.guardNegatives.iterator();
while (it.hasNext()) {
List<ProcessContextEquation> eqs = it.next();
HeadCompiler negcmp = hc.getNormalizedHeadCompiler();
Expand Down
553 changes: 290 additions & 263 deletions src/compile/parser/LMNParser.java

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions src/compile/parser/SrcAtom.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

/** ソースファイル中のアトム表現 */
@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE)
class SrcAtom {
class SrcAtom extends SrcElement {

@JsonTypeInfo(use = Id.CLASS)
protected LinkedList process = null;
protected LinkedList<SrcElement> process = null;

/** 名前トークン */
protected SrcName srcname;
Expand Down Expand Up @@ -43,15 +43,15 @@ public SrcAtom(String name) {
* @param srcname 名前トークン
*/
public SrcAtom(SrcName srcname) {
this(srcname, new LinkedList(), -1, -1);
this(srcname, new LinkedList<>(), -1, -1);
}

/**
* 指定された名前と子供プロセスで初期化します
* @param name アトム名
* @param process 子供プロセス
*/
public SrcAtom(String name, LinkedList process) {
public SrcAtom(String name, LinkedList<SrcElement> process) {
this(new SrcName(name), process, -1, -1);
}

Expand All @@ -60,7 +60,7 @@ public SrcAtom(String name, LinkedList process) {
* @param srcname 名前トークン
* @param process 子供プロセス
*/
public SrcAtom(SrcName srcname, LinkedList process) {
public SrcAtom(SrcName srcname, LinkedList<SrcElement> process) {
this(srcname, process, -1, -1);
}

Expand All @@ -72,7 +72,7 @@ public SrcAtom(SrcName srcname, LinkedList process) {
* @param column ソースコード上での出現位置(桁)
*/
public SrcAtom(SrcName srcname, int line, int column) {
this(srcname, new LinkedList(), line, column);
this(srcname, new LinkedList<>(), line, column);
}

/**
Expand All @@ -83,7 +83,7 @@ public SrcAtom(SrcName srcname, int line, int column) {
* @param line ソースコード上での出現位置(行)
* @param column ソースコード上での出現位置(桁)
*/
public SrcAtom(SrcName nametoken, LinkedList process, int line, int column) {
public SrcAtom(SrcName nametoken, LinkedList<SrcElement> process, int line, int column) {
this.srcname = nametoken;
this.process = process;
this.line = line;
Expand Down Expand Up @@ -121,12 +121,12 @@ public int getNameType() {
* このアトムの子プロセスを得ます
* @return 子プロセスのリスト
*/
public LinkedList getProcess() {
public LinkedList<SrcElement> getProcess() {
return process;
}

public SrcAtom clone() {
return new SrcAtom(srcname.clone(), (LinkedList) process.clone(), line, column);
return new SrcAtom(srcname.clone(), new LinkedList<SrcElement>(process), line, column);
}

public String toString() {
Expand Down
2 changes: 1 addition & 1 deletion src/compile/parser/SrcContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* <p>プロセス文脈名およびルール文脈名には '...' や [[...]] が使えないようにした。
*/
@JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.ANY)
abstract class SrcContext {
abstract class SrcContext extends SrcElement {

protected String name = null;
protected int lineno = -1;
Expand Down
8 changes: 4 additions & 4 deletions src/compile/parser/SrcDumper.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static String dumpAtom(SrcAtom atom) {
return s;
}

public static String dumpLinkedList(LinkedList list, String sep) {
public static String dumpLinkedList(LinkedList<SrcElement> list, String sep) {
if (list == null || list.size() == 0) return "";
String s = "";
s += dump(list.get(0));
Expand Down Expand Up @@ -77,7 +77,7 @@ public static String dumpTypeDef(SrcTypeDef typedef) {
return s;
}

public static String dump(Object obj) {
public static String dump(SrcElement obj) {
if (obj instanceof SrcLink) {
return dumpLink((SrcLink) obj);
} else if (obj instanceof SrcAtom) {
Expand All @@ -90,8 +90,8 @@ public static String dump(Object obj) {
return dumpProcessContext((SrcProcessContext) obj);
} else if (obj instanceof SrcRuleContext) {
return dumpRuleContext((SrcRuleContext) obj);
} else if (obj instanceof LinkedList) {
return dumpLinkedList((LinkedList) obj, ", ");
} else if (obj instanceof SrcList) {
return dumpLinkedList(((SrcList) obj).list, ", ");
} else if (obj instanceof SrcTypeDef) {
return dumpTypeDef((SrcTypeDef) obj);
}
Expand Down
3 changes: 3 additions & 0 deletions src/compile/parser/SrcElement.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package compile.parser;

abstract class SrcElement {}
15 changes: 15 additions & 0 deletions src/compile/parser/SrcList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package compile.parser;

import java.util.LinkedList;

class SrcList extends SrcElement {
LinkedList<SrcElement> list;

public SrcList() {
this(new LinkedList<>());
}

public SrcList(LinkedList<SrcElement> list) {
this.list = list;
}
}
12 changes: 6 additions & 6 deletions src/compile/parser/SrcMembrane.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
/**
* ソースファイル中の膜表現
*/
class SrcMembrane {
class SrcMembrane extends SrcElement {

/** 膜の内容プロセスの表現 */
@JsonTypeInfo(use = Id.CLASS)
LinkedList process = null;
LinkedList<SrcElement> process = null;

/** 終了フラグの有無 */
public boolean stable = false;
Expand All @@ -20,7 +20,7 @@ class SrcMembrane {
public int kind = 0;

/** @指定またはnull */
Object pragma = null;
SrcElement pragma = null;

/** 膜名 */
public String name;
Expand All @@ -29,22 +29,22 @@ class SrcMembrane {
* 空の膜を作成します
*/
public SrcMembrane() {
this(new LinkedList());
this(new LinkedList<>());
}

/**
* 指定された子プロセスを持つ膜を作成します
* @param process 膜に含まれる子プロセス
*/
public SrcMembrane(LinkedList process) {
public SrcMembrane(LinkedList<SrcElement> process) {
this.process = process;
}

/**
* 子プロセスを取得します
* @return 子プロセスのリスト
*/
public LinkedList getProcess() {
public LinkedList<SrcElement> getProcess() {
return process;
}

Expand Down
6 changes: 3 additions & 3 deletions src/compile/parser/SrcProcessContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class SrcProcessContext extends SrcContext {
* <p>利用側でLinkedListを生成して代入すること
*/
@JsonTypeInfo(use = Id.CLASS)
public LinkedList args = null;
public LinkedList<SrcElement> args = null;

/** リンク束 */
public SrcLinkBundle bundle = null;

/** 分離した同名型付きプロセス文脈の名前を格納 */
public LinkedList sameNameList = null;
public LinkedList<String> sameNameList = null;

/** リンク名 */
public String linkName = null;
Expand Down Expand Up @@ -56,7 +56,7 @@ public String getQualifiedName() {
return "$" + name;
}

public LinkedList getSameNameList() {
public LinkedList<String> getSameNameList() {
return sameNameList;
}

Expand Down
Loading