]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/ltk/Location.java
Removed org.simantics.ltk[.antlr] bundles, exact import for antlr
[simantics/platform.git] / bundles / org.simantics.graph.compiler / src / org / simantics / graph / compiler / internal / ltk / Location.java
diff --git a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/ltk/Location.java b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/ltk/Location.java
new file mode 100644 (file)
index 0000000..4bdb814
--- /dev/null
@@ -0,0 +1,45 @@
+package org.simantics.graph.compiler.internal.ltk;
+
+
+public class Location {
+       ISource source;
+       int line;
+       int beginPos;
+       int endPos;
+       
+       public Location(ISource source, int line, int beginPos, int endPos) {
+               this.source = source;
+               this.line = line;
+               this.beginPos = beginPos;
+               this.endPos = endPos;
+       }
+       
+       public Location(ISource source) {
+               this(source, 0, 0, 0);
+       }
+
+       @Override
+       public String toString() {
+               return line + ":" + beginPos;
+       }
+       
+       public ISource getSource() {
+               return source;
+       }
+       
+       public void setSource(ISource source) {
+               this.source = source;
+       }
+       
+       public int getLine() {
+               return line + source.startLine();
+       }
+       
+       public int getBeginPos() {
+               return beginPos + source.startPos();
+       }
+       
+       public int getEndPos() {
+               return endPos + source.startPos();
+       }
+}