Commit 2e44b1d1 authored by Jonathan Shahen's avatar Jonathan Shahen

Moved BooleanErrorListener to the Globals repo

parent 9c059c00
...@@ -4,8 +4,8 @@ import java.io.*; ...@@ -4,8 +4,8 @@ import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.logging.Logger; import java.util.logging.Logger;
import mohawk.converter.testing.BooleanErrorListener;
import mohawk.global.helper.ParserHelper; import mohawk.global.helper.ParserHelper;
import mohawk.global.parser.BooleanErrorListener;
import mohawk.global.parser.mohawkT.MohawkTARBACParser; import mohawk.global.parser.mohawkT.MohawkTARBACParser;
public class SpecHelper { public class SpecHelper {
......
package mohawk.converter.testing;
import java.util.Collections;
import java.util.List;
import java.util.logging.Logger;
import org.antlr.v4.runtime.*;
public class BooleanErrorListener extends BaseErrorListener {
public final Logger logger = Logger.getLogger("mohawk");
public Boolean errorFound = false;
@Override
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine,
String msg, RecognitionException e) {
List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
Collections.reverse(stack);
System.err.println("rule stack: " + stack);
System.err.println("line " + line + ":" + charPositionInLine + " at " + offendingSymbol + ": " + msg);
errorFound = true;
}
@Override
public String toString() {
return errorFound.toString();
}
}
...@@ -10,6 +10,7 @@ import org.junit.Test; ...@@ -10,6 +10,7 @@ import org.junit.Test;
import mohawk.converter.logging.MohawkConsoleFormatter; import mohawk.converter.logging.MohawkConsoleFormatter;
import mohawk.converter.to.asaptime.ConvertToASAPTimeNSA; import mohawk.converter.to.asaptime.ConvertToASAPTimeNSA;
import mohawk.converter.to.asaptime.ConvertToASAPTimeSA; import mohawk.converter.to.asaptime.ConvertToASAPTimeSA;
import mohawk.global.parser.BooleanErrorListener;
import mohawk.global.parser.mohawkT.MohawkTARBACParser; import mohawk.global.parser.mohawkT.MohawkTARBACParser;
import mohawk.global.pieces.MohawkT; import mohawk.global.pieces.MohawkT;
import mohawk.global.timing.MohawkTiming; import mohawk.global.timing.MohawkTiming;
......
...@@ -9,6 +9,7 @@ import org.junit.Test; ...@@ -9,6 +9,7 @@ import org.junit.Test;
import mohawk.converter.logging.MohawkConsoleFormatter; import mohawk.converter.logging.MohawkConsoleFormatter;
import mohawk.converter.to.tred.ConvertToTRole; import mohawk.converter.to.tred.ConvertToTRole;
import mohawk.global.parser.BooleanErrorListener;
import mohawk.global.parser.mohawkT.MohawkTARBACParser; import mohawk.global.parser.mohawkT.MohawkTARBACParser;
import mohawk.global.pieces.MohawkT; import mohawk.global.pieces.MohawkT;
import mohawk.global.timing.MohawkTiming; import mohawk.global.timing.MohawkTiming;
......
...@@ -13,6 +13,7 @@ import org.junit.Test; ...@@ -13,6 +13,7 @@ import org.junit.Test;
import mohawk.global.FileExtensions; import mohawk.global.FileExtensions;
import mohawk.global.helper.ParserHelper; import mohawk.global.helper.ParserHelper;
import mohawk.global.parser.BooleanErrorListener;
import mohawk.global.parser.mohawkT.MohawkTARBACParser; import mohawk.global.parser.mohawkT.MohawkTARBACParser;
import mohawk.global.pieces.*; import mohawk.global.pieces.*;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment