use of abs.frontend.parser.ParseException in project abstools by abstools.
the class SyntaxErrorCollector method syntaxError.
@Override
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
SyntaxError err = new SyntaxError(msg, line, charPositionInLine + 1);
err.setFile(filename);
parserErrors.add(err);
// super.syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
if (raiseExceptions) {
throw new ParseException(err);
}
}
use of abs.frontend.parser.ParseException in project abstools by abstools.
the class ABSCodeScanner method setRange.
/**
* Gets called before the first {@link #nextToken()}. Parses the current document.
*
* @see org.eclipse.jface.text.rules.ITokenScanner#setRange(org.eclipse.jface.text.IDocument, int, int)
*/
@Override
public void setRange(IDocument document, int offset, int length) {
Assert.isLegal(document != null);
final int documentLength = document.getLength();
checkRange(offset, length, documentLength);
fDocument = document;
fOffset = offset;
fRangeEnd = offset + length;
String[] delimiters = fDocument.getLegalLineDelimiters();
fDelimiters = new char[delimiters.length][];
for (int i = 0; i < delimiters.length; i++) fDelimiters[i] = delimiters[i].toCharArray();
String doccontent = document.get();
try {
compilationUnit = null;
Main absParser = new Main();
absParser.setTypeChecking(false);
compilationUnit = absParser.parseUnit(new File(fEditor.getEditorInput().getName()), doccontent, new StringReader(doccontent));
Model m;
// Redmine #86: inh eq CompilationUnit...lookupModule() requires a parent.
(m = new Model()).addCompilationUnit(compilationUnit);
} catch (ParseException e) {
if (doDebug)
e.printStackTrace();
} catch (Exception e) {
if (doDebug)
e.printStackTrace();
}
}
Aggregations