Skip to content
Snippets Groups Projects
Commit fe88437e authored by dgelessus's avatar dgelessus
Browse files

Merge branch 'develop'

parents cf0501da 7d13deba
No related branches found
No related tags found
No related merge requests found
Pipeline #144788 passed
Showing
with 424 additions and 330 deletions
This file contains the name of all copyright holders. This file contains the name of all copyright holders.
Etienne M. Gagnon <etienne.gagnon@uqam.ca> Etienne M. Gagnon <egagnon@j-meg.com>
Ben Menking <bmenking@bigfoot.com> Ben Menking <bmenking@bigfoot.com>
Mariusz Nowostawski <mariusz@marni.otago.ac.nz> Mariusz Nowostawski <mariusz@marni.otago.ac.nz>
Komivi Kevin Agbakpem <agbakpem.komivi@courrier.uqam.ca> Komivi Kevin Agbakpem <kevin.agbakpem@gmail.com>
Kis Gergely <kisg@inf.bme.hu> Kis Gergely <kisg@inf.bme.hu>
Benne Otten <benneotten@gmail.com>
SableCC, an object-oriented compiler framework. SableCC, an object-oriented compiler framework.
Copyright (C) 1997-2003 Etienne M. Gagnon <etienne.gagnon@uqam.ca> and Copyright (C) 1997-2012 Etienne M. Gagnon <egagnon@j-meg.com>,
others. All rights reserved. 2009-2024 HHU Düsseldorf STUPS Group, and others. All rights reserved.
See the file "AUTHORS" for the name of all copyright holders. See the file "AUTHORS" for the name of all copyright holders.
......
SableCC 3.2 - STUPS version # SableCC 3 - STUPS version
===
[![Build Status](https://travis-ci.org/bendisposto/sablecc-stups.svg)](https://travis-ci.org/bendisposto/sablecc-stups) This work is based on SableCC 3.6 by Etienne Gagnon and others.
This work is based on SableCC 3.2 by Etienne Gagnon.
Our version of SableCC enriches the abstract syntax tree with information about tokens. Our version of SableCC enriches the abstract syntax tree with information about tokens.
Contributors to the extension of SableCC are: Contributors to the extension of SableCC are:
...@@ -11,26 +8,29 @@ Contributors to the extension of SableCC are: ...@@ -11,26 +8,29 @@ Contributors to the extension of SableCC are:
- Fabian Fritz - Fabian Fritz
- Marc Büngener - Marc Büngener
- Jens Bendisposto - Jens Bendisposto
- Joy Clark
- Sebastian Krings
- Domnink Hansen
- Michael Leuschel
- D. Geleßus
The authors of the SableCC version this work is based on are listed in the AUTHORS file. The authors of the original SableCC 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 This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. Lesser General Public License for more details.
License ## License
---
This derived work is, like SableCC, covered by the GNU Lesser General Public License. You can view the copyright notice and the exact terms of the license in the files LICENSE, AUTHORS and COPYING-LESSER. This derived work is, like SableCC, covered by the GNU Lesser General Public License. You can view the copyright notice and the exact terms of the license in the files LICENSE, AUTHORS and COPYING-LESSER.
Building ## Building
---
* Clone the repository. * Clone the repository.
* Run the `assemble` target using Gradle (`./gradlew assemble` on Linux/macOS/etc., `gradlew.bat assemble` on Windows). * Run the `assemble` target using Gradle (`./gradlew assemble` on Linux/macOS/etc., `gradlew.bat assemble` on Windows).
* The binary is located in the build/libs subdirectory. * The binary is located in the build/libs subdirectory.
Documentation ## Documentation
---
You can find complete and detailed documentation on the SableCC framework and syntax at the site http://sablecc.org/documentation.html You can find complete and detailed documentation on the SableCC framework and syntax at the site http://sablecc.org/documentation.html
apply plugin: 'application' plugins {
apply plugin: 'java' id "application"
apply plugin: 'eclipse' id "java"
apply plugin: 'maven-publish' id "maven-publish"
apply plugin: 'signing' id "signing"
}
allprojects { allprojects {
project.group = 'de.hhu.stups' project.group = 'de.hhu.stups'
project.version = '3.8.0' project.version = "3.9.0"
project.ext.isSnapshot = project.version.endsWith("-SNAPSHOT") project.ext.isSnapshot = project.version.endsWith("-SNAPSHOT")
ext."signing.secretKeyRingFile" = rootProject.file("secring.gpg").absolutePath ext."signing.secretKeyRingFile" = rootProject.file("secring.gpg").absolutePath
...@@ -22,7 +23,6 @@ dependencies { ...@@ -22,7 +23,6 @@ dependencies {
java { java {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar() withSourcesJar()
withJavadocJar() withJavadocJar()
...@@ -37,6 +37,14 @@ processResources { ...@@ -37,6 +37,14 @@ processResources {
filesMatching("org/sablecc/sablecc/build.properties") { filesMatching("org/sablecc/sablecc/build.properties") {
expand(version: project.version) expand(version: project.version)
} }
// Copy license-related files from repository root into resources
from(project.projectDir) {
rename({name -> "org/sablecc/sablecc/" + name})
include("AUTHORS")
include("COPYING-LESSER")
include("LICENSE")
}
} }
// Run this task to regenerate the SableCC parser using itself. // Run this task to regenerate the SableCC parser using itself.
......
No preview for this file type
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
...@@ -84,7 +86,8 @@ done ...@@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
......
...@@ -36,18 +36,16 @@ public class SableCC { ...@@ -36,18 +36,16 @@ public class SableCC {
private static void displayCopyright() { private static void displayCopyright() {
System.out.println(); System.out.println();
System.out.println("SableCC version " + Version.VERSION System.out.println("SableCC STUPS version " + Version.VERSION);
+ " HHU Version"); System.out.println("Copyright (C) 1997-2012 Etienne M. Gagnon <egagnon@j-meg.com>,");
System.out System.out.println("2009-2024 HHU Düsseldorf STUPS Group, and others. All rights reserved.");
.println("Copyright (C) 1997-2003 Etienne M. Gagnon <etienne.gagnon@uqam.ca> and");
System.out.println("others. All rights reserved.");
System.out.println(); System.out.println();
System.out System.out
.println("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); .println("This software comes with ABSOLUTELY NO WARRANTY. This is free software,");
System.out System.out
.println("and you are welcome to redistribute it under certain conditions."); .println("and you are welcome to redistribute it under certain conditions.");
System.out.println(); System.out.println();
System.out.println("Type 'sablecc -license' to view"); System.out.println("Type 'sablecc --license' to view");
System.out.println("the complete copyright notice and license."); System.out.println("the complete copyright notice and license.");
System.out.println(); System.out.println();
} }
......
...@@ -176,7 +176,7 @@ public class Lexer ...@@ -176,7 +176,7 @@ public class Lexer
case -1: case -1:
if(this.text.length() > 0) if(this.text.length() > 0)
{ {
throw new LexerException("[" + (startLine + 1) + "," + (startPos + 1) + "] Unknown token: " + this.text); throw new LexerException(startLine + 1, startPos + 1, "Unknown token: " + this.text);
} }
return new EOF(startLine + 1, startPos + 1); return new EOF(startLine + 1, startPos + 1);
...@@ -350,7 +350,7 @@ public class Lexer ...@@ -350,7 +350,7 @@ public class Lexer
break; break;
default: default:
throw new LexerException("[" + (startLine + 1) + "," + (startPos + 1) + "] Internal lexer error: invalid accept table entry " + acceptToken + ", current text: " + this.text); throw new LexerException(startLine + 1, startPos + 1, "Internal lexer error: invalid accept table entry " + acceptToken + ", current text: " + this.text);
} }
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
......
...@@ -2,11 +2,43 @@ ...@@ -2,11 +2,43 @@
package org.sablecc.sablecc.lexer; package org.sablecc.sablecc.lexer;
@SuppressWarnings({"serial"}) @SuppressWarnings("serial")
public class LexerException extends Exception public class LexerException extends Exception
{ {
private final int line;
private final int pos;
private final String realMsg;
public LexerException(int line, int pos, String message, Throwable cause)
{
super("[" + line + "," + pos + "] " + message, cause);
this.line = line;
this.pos = pos;
this.realMsg = message;
}
public LexerException(int line, int pos, String message)
{
this(line, pos, message, null);
}
public LexerException(String message) public LexerException(String message)
{ {
super(message); this(0, 0, message);
}
public int getLine()
{
return this.line;
}
public int getPos()
{
return this.pos;
}
public String getRealMsg()
{
return this.realMsg;
} }
} }
This diff is collapsed.
...@@ -2,20 +2,31 @@ ...@@ -2,20 +2,31 @@
package org.sablecc.sablecc.parser; package org.sablecc.sablecc.parser;
import org.sablecc.sablecc.node.*; import org.sablecc.sablecc.node.Token;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ParserException extends Exception public class ParserException extends Exception
{ {
Token token; private final Token token;
String realMsg; private final String realMsg;
public ParserException(Token token, String message) public ParserException(Token token, String message, Throwable cause)
{ {
super(message); super("[" + token.getLine() + "," + token.getPos() + "] " + message, cause);
this.token = token; this.token = token;
this.realMsg = message;
}
public ParserException(Token token, String message)
{
this(token, message, (Throwable)null);
} }
/**
* @deprecated Use {@link #ParserException(Token, String)} instead.
* The token position info is now added automatically to the message.
*/
@Deprecated
public ParserException(Token token, String prefix, String message) public ParserException(Token token, String prefix, String message)
{ {
super(prefix+message); super(prefix+message);
......
...@@ -10,12 +10,44 @@ Macro:LexerException ...@@ -10,12 +10,44 @@ Macro:LexerException
package $0$lexer; package $0$lexer;
@SuppressWarnings({"serial"}) @SuppressWarnings("serial")
public class LexerException extends Exception public class LexerException extends Exception
{ {
private final int line;
private final int pos;
private final String realMsg;
public LexerException(int line, int pos, String message, Throwable cause)
{
super("[" + line + "," + pos + "] " + message, cause);
this.line = line;
this.pos = pos;
this.realMsg = message;
}
public LexerException(int line, int pos, String message)
{
this(line, pos, message, null);
}
public LexerException(String message) public LexerException(String message)
{ {
super(message); this(0, 0, message);
}
public int getLine()
{
return this.line;
}
public int getPos()
{
return this.pos;
}
public String getRealMsg()
{
return this.realMsg;
} }
} }
...@@ -200,7 +232,7 @@ public class Lexer ...@@ -200,7 +232,7 @@ public class Lexer
case -1: case -1:
if(this.text.length() > 0) if(this.text.length() > 0)
{ {
throw new LexerException("[" + (startLine + 1) + "," + (startPos + 1) + "] Unknown token: " + this.text); throw new LexerException(startLine + 1, startPos + 1, "Unknown token: " + this.text);
} }
return new EOF(startLine + 1, startPos + 1); return new EOF(startLine + 1, startPos + 1);
...@@ -244,7 +276,7 @@ $ ...@@ -244,7 +276,7 @@ $
Macro:LexerBody Macro:LexerBody
default: default:
throw new LexerException("[" + (startLine + 1) + "," + (startPos + 1) + "] Internal lexer error: invalid accept table entry " + acceptToken + ", current text: " + this.text); throw new LexerException(startLine + 1, startPos + 1, "Internal lexer error: invalid accept table entry " + acceptToken + ", current text: " + this.text);
} }
pushBack(acceptLength); pushBack(acceptLength);
this.pos = acceptPos; this.pos = acceptPos;
......
...@@ -200,14 +200,14 @@ Macro:ParserParseReduce ...@@ -200,14 +200,14 @@ Macro:ParserParseReduce
{ {
List<?> list = new$0$(); List<?> list = new$0$();
push(goTo($1$), list); push(goTo($1$), list);
}
break; break;
}
$ $
Macro:ParserParseTail Macro:ParserParseTail
default: default:
throw new ParserException(lastToken, "[" + lastToken.getLine() + "," + lastToken.getPos() + "] Internal parser error: invalid action table REDUCE destination " + destination + ", current state " + state()); throw new ParserException(lastToken, "Internal parser error: invalid action table REDUCE destination " + destination + ", current state " + state());
} }
break; break;
...@@ -217,12 +217,10 @@ Macro:ParserParseTail ...@@ -217,12 +217,10 @@ Macro:ParserParseTail
return new Start(top, eof); return new Start(top, eof);
case ERROR: case ERROR:
throw new ParserException(lastToken, throw new ParserException(lastToken, Parser.errorMessages[Parser.errors[destination]]);
"[" + lastToken.getLine() + "," + lastToken.getPos() + "] " ,
Parser.errorMessages[Parser.errors[destination]]);
default: default:
throw new ParserException(lastToken, "[" + lastToken.getLine() + "," + lastToken.getPos() + "] Internal parser error: invalid action table entry " + action + ", destination " + destination + ", current state " + state()); throw new ParserException(lastToken, "Internal parser error: invalid action table entry " + action + ", destination " + destination + ", current state " + state());
} }
} }
} }
...@@ -506,20 +504,31 @@ Macro:ParserException ...@@ -506,20 +504,31 @@ Macro:ParserException
package $0$parser; package $0$parser;
import $0$node.*; import $0$node.Token;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class ParserException extends Exception public class ParserException extends Exception
{ {
Token token; private final Token token;
String realMsg; private final String realMsg;
public ParserException(Token token, String message) public ParserException(Token token, String message, Throwable cause)
{ {
super(message); super("[" + token.getLine() + "," + token.getPos() + "] " + message, cause);
this.token = token; this.token = token;
this.realMsg = message;
}
public ParserException(Token token, String message)
{
this(token, message, (Throwable)null);
} }
/**
* @deprecated Use {@link #ParserException(Token, String)} instead.
* The token position info is now added automatically to the message.
*/
@Deprecated
public ParserException(Token token, String prefix, String message) public ParserException(Token token, String prefix, String message)
{ {
super(prefix+message); super(prefix+message);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment