Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit

Permalink
Getting fixes for errors correct
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKlint committed Dec 10, 2024
1 parent 89b6e0c commit fad3f35
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 27 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
<dependency>
<groupId>org.rascalmpl</groupId>
<artifactId>rascal</artifactId>
<version>0.40.17</version>
<version>0.40.18-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -463,30 +463,42 @@ loc rascalCreateLogicalLoc(Define def, str _modelName, PathConfig pcfg){
return def.defined;
}

@memo
rel[str shortName, str longName] getModuleNames(PathConfig pcfg){
longNames = {};
for(srcdir <- pcfg.srcs){
for(loc mloc <- find(srcdir, "rsc")){
try {
longName = getModuleName(mloc, pcfg);
longNames += <asBaseModuleName(longName), longName>;
} catch _: ;
}
}
for(libdir <- pcfg.libs){
for(loc mloc <- find(libdir, "tpl")){
try {
longName = getModuleName(mloc, pcfg);
longNames += <asBaseModuleName(longName), longName>;
} catch _: ;
}
}
return longNames;
}

list[str] rascalSimilarNames(Use u, TModel tm){
w = getOrgId(u);
nw = size(w);
idRoles = u.idRoles;
pcfg = tm.config.typepalPathConfig;
vocabulary = {};
longNames = {};
if(moduleId() in idRoles){
for(srcdir <- pcfg.srcs){
for(loc mloc <- find(srcdir, "rsc")){
try {
longName = getModuleName(mloc, pcfg);
shortName = asBaseModuleName(longName);
vocabulary += shortName;
longNames += <shortName, longName>;
} catch _: ;
}
}
longNames = getModuleNames(pcfg);
similar = similarWords(w, domain(longNames), tm.config.cutoffForNameSimilarity)[0..10];
return sort({*longNames[s] | s <- similar }, bool (str a, str b) { return size(a) < size(b); });
} else {
vocabulary = { d.orgId | d <- tm.defines, d.idRole in idRoles, isContainedIn(u.occ, d.scope) };
similar = similarWords(w, vocabulary, tm.config.cutoffForNameSimilarity)[0..10];
return sort(similar, bool (str a, str b) { return a < b; });
}
//println("similarNames: <u>, <idRoles>, <vocabulary>");
similar = similarWords(w, vocabulary, tm.config.cutoffForNameSimilarity)[0..10];
return [ *sort(longNames[s], bool (str a, str b) { return size(a) < size(b); }) | s <- similar ];
}

RascalCompilerConfig rascalCompilerConfig(PathConfig pcfg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,26 @@ public RascalCompilerConfig getPHPCompilerConfig(PathConfig pcfg){
public RascalCompilerConfig getPHPCompilerConfig(){
return rascalCompilerConfig(getPHPPathConfig());
}

// ---- VSCode-----------------------------------------------------------------

public PathConfig getVSCodePathConfig() {
return
pathConfig(
ignores=[],
javaCompilerPath=[],
bin=|target://rascal-core|,
classloaders=[],
libs=[
|lib://rascal|,
|target://typepal| ],
srcs=[|file:///Users/paulklint/git/rascal-core/src/org/rascalmpl/core/library|]);
}

public RascalCompilerConfig getVSCodeCompilerConfig(PathConfig pcfg){
return rascalCompilerConfig(pcfg)[verbose = true][logWrittenFiles=true];
}

public RascalCompilerConfig getVSCodeCompilerConfig(){
return rascalCompilerConfig(getVSCodePathConfig());
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
module lang::rascalcore::compile::Examples::Tst0

import ValueIO;
import IO;

data D = d1(int n);

void main(){
v = d1(42);
writeBinaryValueFile(|home:///tmp.txt|, v);
println("written <v>");
}


import Reflect;

int XX1 = 14 ;
int XXX = 13;

int main() = XX;

0 comments on commit fad3f35

Please sign in to comment.