Search in sources :

Example 1 with OffsetRange

use of kalang.compiler.OffsetRange in project kalang by kasonyang.

the class OffsetRangeHelper method getOffsetRange.

public static OffsetRange getOffsetRange(Token start, Token stop) {
    OffsetRange offset = new OffsetRange();
    offset.startOffset = start.getStartIndex();
    offset.stopOffset = stop.getStopIndex();
    offset.startLine = start.getLine();
    offset.startLineColumn = start.getCharPositionInLine();
    offset.stopLine = stop.getLine();
    offset.stopLineColumn = stop.getCharPositionInLine();
    return offset;
}
Also used : OffsetRange(kalang.compiler.OffsetRange)

Example 2 with OffsetRange

use of kalang.compiler.OffsetRange in project kalang by kasonyang.

the class KalangClassLoader method handleDiagnosis.

@Override
public void handleDiagnosis(Diagnosis diagnosis) {
    if (diagnosis.getKind().isError()) {
        KalangSource source = diagnosis.getSource();
        OffsetRange offset = diagnosis.getOffset();
        throw new CompileException(String.format("%s:%s\n%s", source.getFileName(), offset.startLine, diagnosis.getDescription()));
    }
}
Also used : OffsetRange(kalang.compiler.OffsetRange) KalangSource(kalang.compiler.KalangSource)

Aggregations

OffsetRange (kalang.compiler.OffsetRange)2 KalangSource (kalang.compiler.KalangSource)1