Skip to content
Snippets Groups Projects
Commit e743bb1f authored by Jens Bendisposto's avatar Jens Bendisposto
Browse files

Merge branch 'release/3.2.2'

parents 896b18f9 acf1972d
Branches
Tags
No related merge requests found
......@@ -4,11 +4,18 @@ SableCC 3.2 - STUPS version
This work is based on SableCC 3.2 by Etienne Gagnon.
Our version of SableCC enriches the abstract syntax tree with information about tokens.
Contributors to this vrsion of SableCC are:
Contributors to the extension of SableCC are:
Fabian Fritz
Marc Büngener
Jens Bendisposto
- Fabian Fritz
- Marc Büngener
- Jens Bendisposto
The authors of the SabelCC version this work is based on are listed in the AUTHORS file.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
License
---
......
......@@ -3,11 +3,14 @@ apply plugin: 'eclipse'
apply plugin: 'maven'
project.version = '3.2.1'
project.version = '3.2.2'
project.group = 'de.stups'
repositories {
mavenCentral()
maven {
name "cobra"
url "http://cobra.cs.uni-duesseldorf.de/artifactory/repo"
}
}
dependencies {
......
......@@ -55,8 +55,12 @@ public class Parser implements IParser
private Map<PositionedNode, SourcecodeRange> mapping = new HashMap<PositionedNode, SourcecodeRange>();
public Map<PositionedNode, SourcecodeRange> getMapping() { return this.mapping; }
@SuppressWarnings("unchecked")
private void checkResult(Object elementToCheck) {
checkResult(elementToCheck, false);
}
@SuppressWarnings("unchecked")
private void checkResult(Object elementToCheck, boolean slurp) {
// nodes with no tokens or sub nodes at all may exist
if (this.firstPopped == null) {
return;
......@@ -85,7 +89,7 @@ public class Parser implements IParser
+ elementToCheck);
}
if (!this.getMapping().containsKey(elementToCheck)) {
if (!this.getMapping().containsKey(elementToCheck) || slurp ) {
final PositionedNode node = (PositionedNode) elementToCheck;
// dealing with a one-token element
......
......@@ -6,7 +6,7 @@
package de.hhu.stups.sablecc.patch;
public class SourcePosition {
public class SourcePosition implements Comparable<SourcePosition> {
private final int line;
......@@ -24,4 +24,17 @@ public class SourcePosition {
public int getPos() {
return pos;
}
public int compareTo(SourcePosition that) {
if (that.line < line) return 1;
if (that.line > line) return -1;
return pos-that.pos;
}
@Override
public String toString() {
return "(" + line + "," + pos + ")";
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment