1 46 package org.codehaus.groovy.syntax; 47 48 import org.codehaus.groovy.GroovyException; 49 50 56 public class SyntaxException extends GroovyException { 57 58 59 private int line; 60 61 62 private int column; 63 64 private String sourceLocator; 65 66 public SyntaxException(String message, int line, int column) { 67 super(message, false); 68 this.line = line; 69 this.column = column; 70 } 71 72 public void setSourceLocator(String sourceLocator) { 75 this.sourceLocator = sourceLocator; 76 } 77 78 public String getSourceLocator() { 79 return this.sourceLocator; 80 } 81 82 86 public int getLine() { 87 return line; 88 } 89 90 94 public int getStartColumn() { 95 return column; 96 } 97 98 101 public int getStartLine() { 102 return getLine(); 103 } 104 105 108 public int getEndColumn() { 109 return getStartColumn() + 1; 110 } 111 112 public String getMessage() { 113 String msg = super.getMessage() + " @ line " + line + ", column " + column + "."; 114 return msg; 115 } 116 } 117 | Popular Tags |