Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

<groupId>org.rascalmpl</groupId>
<artifactId>rascal</artifactId>
<version>0.43.0-RC16-SNAPSHOT</version>
<version>0.43.0-RC17-BOOT-PREVIEW-SYNTAX-ROLES-SNAPSHOT</version>
<packaging>jar</packaging>

<scm>
<developerConnection>scm:git:ssh://git@github.com/usethesource/rascal.git</developerConnection>
<tag>HEAD</tag>
<tag>v0.43.0-RC16-BOOT-PREVIEW-SYNTAX-ROLES</tag>
</scm>

<!-- dependency resolution configuration (usethesource) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,78 +566,6 @@ test bool Issue442() = checkModuleOK("

// https://github.com/cwi-swat/rascal/issues/465

test bool Issue465a(){
writeModule("module MMM
lexical IntegerLiteral = [0-9]+;
start syntax Exp = con: IntegerLiteral;");
return checkModuleOK("
module Issue465a
import MMM;
data Exp = con(int n);
");
}

test bool Issue465b(){
writeModule("module MMM
lexical IntegerLiteral = [0-9]+;
start syntax Exp = con: IntegerLiteral;");
return checkModuleOK("
module Issue465b
import MMM;
data Exp = con(int n);
void main() { c = con(5); }
");
}

test bool Issue465c(){
writeModule("module MMM
lexical IntegerLiteral = [0-9]+;
start syntax Exp = con: IntegerLiteral;");
return checkModuleOK("
module Issue465c
import MMM;
data Exp = con(int n);
void main() { data[Exp] c = con(5); }
");
}

test bool Issue465c2(){
writeModule("module MMM
lexical IntegerLiteral = [0-9]+;
start syntax Exp = con: IntegerLiteral;");
return unexpectedTypeInModule("
module Issue465c
import MMM;
data Exp = con(int n);
void main() { Exp c = con(5); } // should trigger an error
");
}


test bool Issue465d(){
writeModule("module MMM
lexical IntegerLiteral = [0-9]+;
start syntax Exp = con: IntegerLiteral;");
return checkModuleOK("
module Issue465d
import MMM;
data Exp = con(int n);
void main() { MMM::Exp c = [MMM::Exp] \"3\"; } // should work because data Exp is not in MMM
");
}

test bool Issue465d2(){
writeModule("module MMM
lexical IntegerLiteral = [0-9]+;
start syntax Exp = con: IntegerLiteral;");
return checkModuleOK("
module Issue465d
import MMM;
data Exp = con(int n);
void main() { syntax[Exp] c = [Exp] \"3\"; }
");
}

// https://github.com/usethesource/rascal/issues/1353
test bool Issue1353() {
writeModule("module MC
Expand Down Expand Up @@ -676,4 +604,4 @@ test bool srcFromExpressionFieldsOK(){
e.rhs.src = |unknown:///|;
}
");
}
}

This file was deleted.

This file was deleted.

8 changes: 1 addition & 7 deletions src/org/rascalmpl/library/lang/sexp/AST.rsc
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@

@synopsis{AST model for S-Expressions.}
@contributor{Tijs van der Storm - storm@cwi.nl (CWI)}
module lang::sexp::SExp

import lang::sexp::\syntax::SExp;
import ParseTree;
module lang::sexp::AST

data SExp
= string(String \str)
Expand All @@ -27,6 +24,3 @@ data SimpleString
data Raw
= raw(int size, str bytes)
;

public SExp parseSExp(str src, loc l)
= implode(#SExp, parse(#lang::sexp::\syntax::SExp::SExp, src, l));
14 changes: 13 additions & 1 deletion src/org/rascalmpl/library/lang/sexp/Parse.rsc
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
@license{
Copyright (c) 2025, NWO-I Centrum Wiskunde & Informatica (CWI)
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
module lang::sexp::Parse

import lang::sexp::AST;
import lang::sexp::Syntax;
import ParseTree;

public data[SExp] parseSExp(str src, loc l)
data[SExp] parseSExp(str src, loc l)
= implode(#data[SExp], parse(#syntax[SExp], src, l));
2 changes: 1 addition & 1 deletion src/org/rascalmpl/library/lang/sexp/Syntax.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@synopsis{Syntax definition for S-Expressions, based on http://people.csail.mit.edu/rivest/Sexp.txt}
@contributor{Tijs van der Storm - storm@cwi.nl (CWI)}

module lang::sexp::\syntax::SExp
module lang::sexp::Syntax

import String;
import IO;
Expand Down
Loading