Permalink
Browse files

Documentation updates

  • Loading branch information...
LadyCailin committed Jan 5, 2018
1 parent 11f7d0a commit 4f10f81846cb4e0bd09e1e32e630e75bae052f41
@@ -24,6 +24,7 @@
import com.laytonsmith.core.constructs.Target;
import com.laytonsmith.core.exceptions.ConfigCompileException;
import com.laytonsmith.core.exceptions.ConfigCompileGroupException;
import com.laytonsmith.core.exceptions.ConfigRuntimeException;
import com.laytonsmith.core.extensions.ExtensionManager;
import com.laytonsmith.core.functions.FunctionBase;
import com.laytonsmith.core.functions.FunctionList;
@@ -479,7 +480,20 @@ public static void main(String[] args) throws Exception {
File source = new File(path);
String plain = FileUtil.read(source);
Security.setSecurityEnabled(false);
String optimized = OptimizationUtilities.optimize(plain, source);
String optimized;
try {
try {
optimized = OptimizationUtilities.optimize(plain, source);
} catch(ConfigCompileException ex) {
Set<ConfigCompileException> group = new HashSet<>();
group.add(ex);
throw new ConfigCompileGroupException(group);
}
} catch(ConfigCompileGroupException ex) {
ConfigRuntimeException.HandleUncaughtException(ex, null);
System.exit(1);
return;
}
StreamUtils.GetSystemOut().println(optimized);
System.exit(0);
} else if (mode == cmdlineMode) {
@@ -873,6 +873,9 @@ private MethodScriptCompiler() {
comment_is_block = false;
continue;
} else { //in a literal
if(c == '\u00A0'/*nbsp*/) {
throw new ConfigCompileException("NBSP character in script", target);
}
buf.append(c);
continue;
}
@@ -205,7 +205,7 @@ private static void DoReport(String message, String exceptionType, ConfigRuntime
if (!"".equals(message.trim())) {
message = ": " + message;
}
Target top = Target.UNKNOWN;
for (StackTraceElement e : st) {
Target t = e.getDefinedAt();
@@ -234,7 +234,7 @@ private static void DoReport(String message, String exceptionType, ConfigRuntime
CArray element = Static.getArray(consElement, t);
int line = Static.getInt32(element.get("line", t), t);
File file = new File(element.get("file", t).val());
int col = 0; // This will need updating eventually
int col = element.getColumn();
Target stElementTarget = new Target(line, file, col);
newSt.add(new StackTraceElement(element.get("id", t).val(), stElementTarget));
}
@@ -259,7 +259,7 @@ private static void DoReport(String message, String exceptionType, ConfigRuntime
currentPlayer.sendMessage(player.toString());
}
}
private static void PrintMessage(StringBuilder log, StringBuilder console, StringBuilder player, String type, String message, Throwable ex, List<StackTraceElement> st){
log.append(type).append(message).append("\n");
console.append(TermColors.RED).append(type).append(TermColors.WHITE).append(message).append("\n");
@@ -280,18 +280,18 @@ private static void PrintMessage(StringBuilder log, StringBuilder console, Strin
}
log.append("\t").append(proc).append(":").append(filepath).append(":")
.append(line)/*.append(".")
.append(column)*/.append("\n");
.append(line).append(".")
.append(column).append("\n");
console.append("\t").append(TermColors.GREEN).append(proc)
.append(TermColors.WHITE).append(":")
.append(TermColors.YELLOW).append(filepath)
.append(TermColors.WHITE).append(":")
.append(TermColors.CYAN).append(line)/*.append(".").append(column)*/.append("\n");
.append(TermColors.CYAN).append(line).append(".").append(column).append("\n");
player.append("\t").append(MCChatColor.GREEN).append(proc)
.append(MCChatColor.WHITE).append(":")
.append(MCChatColor.YELLOW).append(simplepath)
.append(MCChatColor.WHITE).append(":")
.append(MCChatColor.AQUA).append(line)/*.append(".").append(column)*/.append("\n");
.append(MCChatColor.AQUA).append(line).append(".").append(column).append("\n");
}
}
@@ -554,7 +554,7 @@ public CArray getObjectFor(){
/**
* In general, only the core elements should change this
* @param target
* @param target
*/
void setDefinedAt(Target target) {
definedAt = target;
Oops, something went wrong.

0 comments on commit 4f10f81

Please sign in to comment.