forked from IYP-Programer-Yeah/PGen
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Token and Function semantic can contain space and other special character - Detect invalid token or function - Add debug mode to parser
- Loading branch information
1 parent
7f42519
commit 29c5664
Showing
8 changed files
with
156 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package ir.ac.sbu.utility; | ||
|
||
public class CheckUtility { | ||
public static String DELIMITER = ","; | ||
|
||
private CheckUtility() { | ||
} | ||
|
||
public static void checkGraphName(String graphName) { | ||
if (graphName.trim().isEmpty()) { | ||
throw new IllegalArgumentException("Graph name can not be empty."); | ||
} else if (graphName.contains(DELIMITER)) { | ||
throw new IllegalArgumentException("Graph can not contain '" + DELIMITER + "' character."); | ||
} | ||
} | ||
|
||
public static void checkTokenName(String tokenName) { | ||
if (tokenName.startsWith("$")) { | ||
throw new IllegalArgumentException("All string starting with $ are predefined tokens."); | ||
} else if (tokenName.trim().isEmpty()) { | ||
throw new IllegalArgumentException("Token can not be empty."); | ||
} else if (tokenName.contains(DELIMITER)) { | ||
throw new IllegalArgumentException("Token can not contain '" + DELIMITER + "' character."); | ||
} | ||
} | ||
|
||
public static void checkFunctionName(String functionName) { | ||
if (functionName.contains(DELIMITER)) { | ||
throw new IllegalArgumentException("Token can not contain '" + DELIMITER + "' character."); | ||
} else if (functionName.contains(" ")) { | ||
throw new IllegalArgumentException("Token can not contain ' ' character."); | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.