-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UniByteLiteralとUniCharacterLiteral追加
- Loading branch information
Showing
10 changed files
with
200 additions
and
4 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
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
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
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,57 @@ | ||
package net.unicoen.node; | ||
import net.unicoen.node_helper.*; | ||
|
||
public class UniByteLiteral extends UniExpr { | ||
public byte value; | ||
|
||
public UniByteLiteral() { | ||
} | ||
|
||
public UniByteLiteral(byte value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ByteLiteral(" + value + ")"; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = 17; | ||
result = result * 31 + (int)value; | ||
result = result * 31 + (comments == null ? 0 : comments.hashCode()); | ||
result = result * 31 + (codeRange == null ? 0 : codeRange.hashCode()); | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj == null || !(obj instanceof UniByteLiteral)) return false; | ||
UniByteLiteral that = (UniByteLiteral)obj; | ||
return this.value == that.value | ||
&& (this.comments == null ? that.comments == null : this.comments.equals(that.comments)) | ||
&& (this.codeRange == null ? that.codeRange == null : this.codeRange.equals(that.codeRange)); | ||
} | ||
|
||
@Override | ||
public boolean isStatement() { | ||
return false; | ||
} | ||
|
||
public void merge(UniByteLiteral that) { | ||
if (that.value != 0) { | ||
this.value = that.value; | ||
} | ||
if (that.comments != null) { | ||
if (this.comments == null) { | ||
this.comments = that.comments; | ||
} else { | ||
this.comments.addAll(that.comments); | ||
} | ||
} | ||
if (that.codeRange != null) { | ||
this.codeRange = that.codeRange; | ||
} | ||
} | ||
} |
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,57 @@ | ||
package net.unicoen.node; | ||
import net.unicoen.node_helper.*; | ||
|
||
public class UniCharacterLiteral extends UniExpr { | ||
public char value; | ||
|
||
public UniCharacterLiteral() { | ||
} | ||
|
||
public UniCharacterLiteral(char value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CharacterLiteral(" + value + ")"; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = 17; | ||
result = result * 31 + (int)value; | ||
result = result * 31 + (comments == null ? 0 : comments.hashCode()); | ||
result = result * 31 + (codeRange == null ? 0 : codeRange.hashCode()); | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj == null || !(obj instanceof UniCharacterLiteral)) return false; | ||
UniCharacterLiteral that = (UniCharacterLiteral)obj; | ||
return this.value == that.value | ||
&& (this.comments == null ? that.comments == null : this.comments.equals(that.comments)) | ||
&& (this.codeRange == null ? that.codeRange == null : this.codeRange.equals(that.codeRange)); | ||
} | ||
|
||
@Override | ||
public boolean isStatement() { | ||
return false; | ||
} | ||
|
||
public void merge(UniCharacterLiteral that) { | ||
if (that.value != 0) { | ||
this.value = that.value; | ||
} | ||
if (that.comments != null) { | ||
if (this.comments == null) { | ||
this.comments = that.comments; | ||
} else { | ||
this.comments.addAll(that.comments); | ||
} | ||
} | ||
if (that.codeRange != null) { | ||
this.codeRange = that.codeRange; | ||
} | ||
} | ||
} |
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