Skip to content
Draft
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
96 changes: 2 additions & 94 deletions src/org/rascalmpl/library/IO.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,6 @@ Otherwise, the same method of deciding the character set is used as in ((readFil
public java void appendToFile(loc file, value V..., str charset=DEFAULT_CHARSET, bool inferCharset=!(charset?))
throws PathNotFound, IO;

@synopsis{Append a value to a file.}
@description{
Append a textual representation of some values to an existing or a newly created file:

* If a value is a simple string, the quotes are removed and the contents are de-escaped.
* If a value has a non-terminal type, the parse tree is unparsed to produce a value.
* All other values are printed as-is.
* Each value is terminated by a newline character.

Files are encoded using the charset provided.
}
@deprecated{
Use `appendToFile(file, V, charset=DEFAULT_CHARSET)` instead.
}
public void appendToFileEnc(loc file, str charset, value V...) throws PathNotFound, IO
= appendToFile(file, V, charset=charset, inferCharset=false);

@synopsis{Returns all available character sets.}
@javaClass{org.rascalmpl.library.Prelude}
public java set[str] charsets();
Expand Down Expand Up @@ -551,7 +534,7 @@ Also see ((readFileLines)).
}
@encoding{
A text file can be encoded in many different character sets, most common are UTF8, ISO-8859-1, and ASCII.
If you know the encoding of the file, please use the ((readFileEnc)) and ((readFileLinesEnc)) overloads.
If you know the encoding of the file, please use the `charset` argument.
If you do not know, we try to detect this. This detection is explained below:

* If the implementation of the used scheme in the location
Expand All @@ -575,41 +558,20 @@ the first 32 bytes of the file are not valid UTF-8.
public java str readFile(loc file, str charset=DEFAULT_CHARSET, bool inferCharset=!(charset?))
throws PathNotFound, IO;

@synopsis{Read the contents of a location and return it as string value.}
@description{
Return the contents (decoded using the Character set supplied) of a file location as a single string.
Also see ((readFileLinesEnc)).
}
@deprecated{
Use `readFile(file, inferCharset=false, charset=DEFAULT_CHARSET)` instead.
}
public str readFileEnc(loc file, str charset) throws PathNotFound, IO
= readFile(file, inferCharset=false, charset=charset);

@synopsis{Read the content of a file and return it as a base-64 encoded string.}
@description {
}
@javaClass{org.rascalmpl.library.Prelude}
public java str readBase64(loc file, bool includePadding=true)
throws PathNotFound, IO;

@deprecated{
Use readBase64 instead.
}
public str uuencode(loc file) = readBase64(file);

@synopsis{Decode a base-64 encoded string and write the resulting bytes to a file.}
@description {
}
@javaClass{org.rascalmpl.library.Prelude}
public java void writeBase64(loc file, str content)
throws PathNotFound, IO;

@deprecated{
Use writeBase64 instead.
}
public void uudecode(loc file, str content) = writeBase64(file, content);

@synopsis{Read the content of a file and return it as a base-32 encoded string.}
@description {
}
Expand Down Expand Up @@ -661,19 +623,6 @@ public void writeFileLines(loc file, list[str] lines, str charset=DEFAULT_CHARSE
charset=charset);
}

@synopsis{Read the contents of a file location and return it as a list of strings.}
@description{
Return the contents (decoded using the Character set supplied) of a file location as a list of lines.
Also see ((readFileLines)).
}
@deprecated{
Use `readFileLines(file, charset=DEFAULT_CHARSET)` instead.
}
public list[str] readFileLinesEnc(loc file, str charset)
throws PathNotFound, IO
= readFileLines(file, charset=charset);


@javaClass{org.rascalmpl.library.Prelude}
@synopsis{Remove files or directories}
public java void remove(loc file, bool recursive=true) throws IO;
Expand All @@ -700,7 +649,7 @@ Write a textual representation of some values to a file:
* All other values are printed as-is.
* Each value is terminated by a newline character.

Files are encoded in UTF-8, in case this is not desired, use ((writeFileEnc)).
Files are encoded in UTF-8, in case this is not desired, use the `charset` argument.
}
@javaClass{org.rascalmpl.library.Prelude}
public java void writeFile(loc file, value V..., str charset=DEFAULT_CHARSET)
Expand All @@ -711,25 +660,6 @@ throws PathNotFound, IO;
public java void writeFileBytes(loc file, list[int] bytes)
throws PathNotFound, IO;


@synopsis{Write values to a file.}
@description{
Write a textual representation of some values to a file:

* If a value is a simple string, the quotes are removed and the contents are de-escaped.
* If a value has a non-terminal type, the parse tree is unparsed to produce a value.
* All other values are printed as-is.
* Each value is terminated by a newline character.

Files are encoded using the charset provided.
}
@deprecated{
Use `writeFile(file, charset=...)` instead.
}
public void writeFileEnc(loc file, str charset, value V...) throws PathNotFound, IO
= writeFile(file, V, charset=charset);


@synopsis{Read the contents of a location and return its MD5 hash.}
@description{
MD5 hash the contents of a file location.
Expand All @@ -745,31 +675,9 @@ public java str md5Hash(value v);
@javaClass{org.rascalmpl.library.Prelude}
public java str createLink(str title, str target);


@javaClass{org.rascalmpl.library.Prelude}
@deprecated{
Use `readBase64` instead.
}
public java str toBase64(loc file, bool includePadding=true)
throws PathNotFound, IO;

@javaClass{org.rascalmpl.library.Prelude}
java void copy(loc source, loc target, bool recursive=false, bool overwrite=true) throws IO;

@deprecated{
Use the `copy` function instead
}
void copyFile(loc source, loc target) {
copy(source, target, recursive=false, overwrite=true);
}

@deprecated{
Use the `copy` function instead
}
void copyDirectory(loc source, loc target) {
copy(source, target, recursive=true, overwrite=true);
}

@javaClass{org.rascalmpl.library.Prelude}
@synopsis{Is an alias for ((rename))}
java void move(loc source, loc target, bool overwrite=true) throws IO;
Expand Down
45 changes: 9 additions & 36 deletions src/org/rascalmpl/library/Node.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ getKeywordParameters("f"(10, "abc", height=0));
@javaClass{org.rascalmpl.library.Prelude}
public java map[str,value] getKeywordParameters(node T);

@deprecated{
Use getKeywordParameters(T)
}
public map[str, value] getAnnotations(node T) = getKeywordParameters(T);


@synopsis{Set the keyword parameters of a node.}
@examples{
Expand All @@ -65,24 +60,17 @@ setKeywordParameters("f"(10, "abc"), ("height":0));
@javaClass{org.rascalmpl.library.Prelude}
public java &T <: node setKeywordParameters(&T <: node x, map[str,value] keywordParameters);

// @synopsis{Adds new keyword parameters to a node, keeping the existing ones unless there is an entry in the new map.}
// @examples{
// ```rascal-shell
// import Node;
// mergeKeywordParameters("f"(10, "abc", width=10), ("height":0));
// ```
// }
// @javaClass{org.rascalmpl.library.Prelude}
// TODO: uncomment after bootstrap
// public java &T <: node mergeKeywordParameters(&T <: node x, map[str,value] keywordParameters);
@synopsis{Adds new keyword parameters to a node, keeping the existing ones unless there is an entry in the new map.}
@examples{
```rascal-shell
import Node;
mergeKeywordParameters("f"(10, "abc", width=10), ("height":0));
```
}
@javaClass{org.rascalmpl.library.Prelude}
public java &T <: node mergeKeywordParameters(&T <: node x, map[str,value] keywordParameters);


@deprecated{
Use setKeywordParameters(x, keywordParameters)
}
public &T <: node setAnnotations(&T <: node x, map[str,value] keywordParameters)
= setKeywordParameters(x, keywordParameters);


@synopsis{Determine the name of a node.}
@examples{
Expand Down Expand Up @@ -110,11 +98,6 @@ public java node makeNode(str N, value V..., map[str, value] keywordParameters =
@javaClass{org.rascalmpl.library.Prelude}
public java &T <: node unset(&T <: node x, str keywordParameter);

@deprecated{
Use unset(x, kw)
}
public &T <: node delAnnotation(&T <: node x, str keywordParameter) = unset(x, keywordParameter);


@synopsis{Reset a set of keyword parameters back to their default on a node.}
public &T <: node unset(&T <: node x, set[str] keywordParameters){
Expand All @@ -130,21 +113,11 @@ public &T <: node unset(&T <: node x, set[str] keywordParameters){
@javaClass{org.rascalmpl.library.Prelude}
public java &T <: node unset(&T <: node x);

@deprecated{
Use `unset(x)`
}
public &T <: node delAnnotations(&T <: node x) = unset(x);


@synopsis{Recursively reset all keyword parameters of the node and its children back to their default.}
@javaClass{org.rascalmpl.library.Prelude}
public java &T unsetRec(&T x);

@deprecated{
Use `unsetRec(x)`
}
public &T delAnnotationsRec(&T x) = unsetRec(x);


@synopsis{Recursively reset a specific keyword parameter of the node and its children back to its default.}
public &T unsetRec(&T x, str keywordParameter) = visit(x) {
Expand Down
17 changes: 0 additions & 17 deletions src/org/rascalmpl/library/Set.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -218,23 +218,6 @@ power1({1,2,3,4});
}
public set[set[&T]] power1(set[&T] st) = power(st) - {{}};

@synopsis{Apply a function to successive elements of a set and combine the results.}
@description{
Apply the function `fn` to successive elements of set `s` starting with `unit`.
}
@examples{
```rascal-shell
import Set;
int add(int x, int y) { return x + y; }
reducer({10, 20, 30, 40}, add, 0);
```
}
@deprecated{Use a reducer expression instead, such as `(init | fn(it,e) | e <- st)`.}
public &T reducer(set[&T] st, &T (&T,&T) fn, &T unit) =
(unit | fn(it,elm) | elm <- st);

public &T reducer(set[&T] _:{}) { throw EmptySet(); }


@synopsis{Determine the number of elements in a set.}
@examples{
Expand Down
42 changes: 0 additions & 42 deletions src/org/rascalmpl/library/String.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -527,24 +527,6 @@ beans ");
public java str trim(str s);


@synopsis{Squeeze repeated occurrences of characters.}
@description{
Squeeze repeated occurrences in `src` of characters in `charSet` removed.
See http://commons.apache.org/lang/api-2.6/index.html?org/apache/commons/lang/text/package-summary.html[Apache]
for the allowed syntax in `charSet`.
}
@examples{
```rascal-shell
import String;
squeeze("hello", "el");
// the other squeeze function uses character class types instead:
squeeze("hello", "el") == squeeze("hello", #[el]);
```
}
@javaClass{org.rascalmpl.library.Prelude}
@deprecated{Use the other squeeze function that accepts Rascal character class syntax.}
public java str squeeze(str src, str charSet);

@synopsis{Squeeze repeated occurrences of characters.}
@description{
Squeeze repeated occurrences in `src` of characters, if they are a member of `&CharClass`, removed.
Expand Down Expand Up @@ -638,30 +620,6 @@ public java str wrap(str src, int wrapLength);
private java str format(str s, str dir, int n, str pad);


@synopsis{Determine if a string matches the given (Java-syntax) regular expression.}
@javaClass{org.rascalmpl.library.Prelude}
@deprecated{
Use `/re/ := s` instead
}
public java bool rexpMatch(str s, str re);


@synopsis{Convert a string value to a (source code) location.}
@description{
* Converts string `s` to a location.
* If the scheme is not provided, it is assumed to be `cwd`.
}
@examples{
```rascal-shell
import String;
toLocation("http://grammarware.net");
toLocation("document.xml");
```
}
@deprecated{Use ((lang::paths::Windows::parseWindowsPath)) for example; toLocation does not handle all intricacies of path notation.}
public loc toLocation(str s) = (/<car:.*>\:\/\/<cdr:.*>/ := s) ? |<car>://<cdr>| : |cwd:///<s>|;


@synopsis{Substitute substrings in a string based on a substitution map from location to string.}
@examples{
```rascal-shell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ import IO;
import List;
import String;

@synopsis{Execute file changes, including in-file edits if present.}
@deprecated{Replaced by ((executeFileSystemChanges)) due to a rename of the concept.}
void executeDocumentEdits(list[FileSystemChange] edits) {
executeFileSystemChanges(edits);
}

@synopsis{Execute file changes, including in-file edits if present.}
void executeFileSystemChanges(list[FileSystemChange] edits) {
for (e <- edits) {
Expand Down
4 changes: 0 additions & 4 deletions src/org/rascalmpl/library/analysis/diff/edits/TextEdits.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ module analysis::diff::edits::TextEdits

extend analysis::diff::edits::FileSystemChanges;

@synopsis{For compatibility we rename FileSystemChange to DocumentEdit}
@deprecated{It's better to use ((FileSystemChange)) for future compatibility.}
alias DocumentEdit = FileSystemChange;

@synopsis{For some FileSystemChanges we know exactly what happened.}
data FileSystemChange
= changed(loc file, list[TextEdit] edits)
Expand Down
18 changes: 0 additions & 18 deletions src/org/rascalmpl/library/analysis/m3/Core.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -236,24 +236,6 @@ M3 modifyM3(loc id, list[M3] models, value (&T,&T) fun) {

bool isEmpty(M3 model) = model.id.scheme == "unknown";

@deprecated{Does not make much sense since containment usually contains only logical locations.}
set[loc] files(M3 model) {
todo = top(model.containment);
done = {};

while (todo != {}) {
<elem,todo> = takeOneFrom(todo);
if (isDirectory(elem)) {
todo += model.containment[elem];
}
else {
done += elem;
}
}

return done;
}

@synopsis{Transform the containment relation to a recursive tree model}
@description{
This makes the containment relation into an abstract ((FileSystem)) for further analysis,
Expand Down
7 changes: 0 additions & 7 deletions src/org/rascalmpl/library/lang/csv/IO.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,6 @@ R1 = readCSV(|project://rascal/src/org/rascalmpl/library/lang/csv/examples/ex1.c
@javaClass{org.rascalmpl.library.lang.csv.IO}
public java value readCSV(loc location, bool header = true, str separator = ",", str encoding = "UTF8");

@deprecated{
Use readCSV with keyword parameters
}
public value readCSV(loc location, map[str,str] options) {
return readCSV(location, header = ((options["header"]?"true") == "true"), separator = options["separator"]?",");
}

@javaClass{org.rascalmpl.library.lang.csv.IO}
public java &T readCSV(type[&T] result, loc location, bool header = true, str separator = ",", str encoding = "UTF8");

Expand Down
Loading
Loading