我不明白为什么我在Rascal中得到了这个错误。 |cwd:///loader.rsc|(391,1,<19,33>,<19,34>): subscript not supported on set[Declaration] at |cwd:///loader.rsc|(391,1,<19,33>,<19,34>)
Advice: |http://tutor.rascal-mpl.org/Errors/Static/UnsupportedOperation/UnsupportedOperation.html| 我从下面的列表理解中得到了这一点:
我试图找到所有的方法调用和包含它们的类。如果我正确理解,模式匹配执行回溯以匹配所有可能的方式。
使用下面的java代码。
package main;
public class Main {
public static void main(String[] args) {
System.out.println("hello world");
System.out.println("hello again");
}
}
我正在用createAstsFromDirectory加载代码。
rascal>ast = c
在我的代码中,我有以下两个方法:
public void AllDivisors(int max) {
lrel[int,list[int]] div = [ <i,d> | int i <- [0 .. max], list[int] d <- GetDivisors(i)];
println("<div>");
}
public list[int] GetDivisors(int n) {
return [ p | p <- [1..n], n % p == 0];
}
第二个(GetDivisor
好的,这是我的场景:
rascal>map[int, list[int]] g = ();
rascal>g += (1:[2]);
这将导致:
rascal>g[1];
list[int]: [2]
到目前为止还不错,但现在我想这样做,但它不起作用:
rascal>g[1] += 3;
|stdin:///|(2,1,<1,2>,<1,3>): insert into collection not supported on value and int
所以我不能直接使用g1中的值,而必须使用一个临时变量,如下所示:
rascal>lst
例如,在Library.java中,有一个新的用户= HashMap HashMap()和users.put (new Integer(user.getCode()),user);。所以我希望put()方法在下面的集合中,但是它返回了空。
rascal> m = createM3FromEclipseProject(elib_dir);
ok
rascal> p = createOFG(elib_dir);
ok
rascal> { m | call(_, _, _, m, _) <- p.statements, method(m, _) <- p.decls}
根据的说法,该语言是静态类型的。但是,类型错误仅在运行时报告。
例如,当我创建这个模块时,我预计会出现一个类型错误,因为我将一个实数赋值给一个int变量:
module Example
void example() {
int x = 1.0;
println(x);
}
当我在REPL上导入模块,并最终运行函数时:
rascal>import Example;
ok
rascal>example()
|project://Test/src/Example.rsc|(39,7,<4,6>,<4,13>): Expected int, but got
我想我并不完全理解Rascal中关键字与模式匹配相关的概念(因为下面的符号实际上是由Rascal支持的)。假设我已经定义了一个数据类型Exp和一个函数demoFun1 (假设在本例中z绑定到y):
data Exp = a(int x, int y = 5) | b(int x);
Exp demoFun1(a(x, y = z)) = b(z);
然后我执行:demoFun1(a(2, y = 3)),Rascal返回:
|stdin:///|(25,4,<1,25>,<1,29>): The called signature: b(value),
does not
在将Clair安装到Rascal 0.17.0之后
import lang::cpp::AST;
给出以下错误:
Could not import module lang::cpp::AST: can not find in search path
我的Rascal项目显示了一些搜索路径条目,但没有显示Clair路径。
关于如何使这件事奏效,有什么建议吗?
注意,我尝试在Rascal的最新版本(0.23)上安装Clair,但是失败了(因此我使用了旧的0.17.0版本):
Missing requirement: clair 0.2.0.202103011036 (clair 0.2.0.202
我维护跨平台C代码库,在一些平台(Xcode 4,红帽派生发行版,如Fedora和Mageia)上,我得到以下编译器错误:
warning: declaration of 'index' shadows a global declaration
基于,我理解这是因为一些基于BSD的C实现在string.h中定义了一个非标准的index函数,这意味着每当我声明一个index变量时,就会出现这个警告。我向您保证,我没有任何全局index变量。
我知道我可以避免命名任何index,但是它是一个语义上有用的名称,所以我最终在所有地方都使用它。我知道我也可以抑制这个警告,例如在GCC中使
列出特定警告的NVCC代码在哪里?
查看其他问题,比如,给出了使用-Xcudafe "--diag_suppress=xxx来抑制警告"xxx“的答案,并链接到可能的警告列表。
但是,当我收到警告时
/usr/include/eigen3/Eigen/src/Core/util/XprHelper.h(94): warning: __host__ annotation is ignored on a function("no_assignment_operator") that is explicitly defaulted on its first decla
根据这一页:
下面是在列表中使用cons的方式:
cons(1,[2,3]); //should return [1,2,3]
在Rascal控制台中尝试这样做:
import List;
cons(1,[2,3]);
给我这个错误:
|stdin:///|(1,13,<1,1>,<1,14>): The called signature: cons(int, list[int]),
does not match any of the declared (overloaded) signature patterns:
Symbol = cons(Symbol,
我已经使用Eclipse开发了一个Rascal程序,但我希望能够在REPL中运行它。当我尝试导入一些所需的库时,我得到如下错误:
|prompt:///|(0,33,<1,0>,<1,33>): Could not import module lang::java::jdt::m3::Core: File rascal://lang::java::jdt::m3::Core not found.
Rascal网站指出,默认情况下这些库不包括在内,但我不知道应该从哪里获得它们,以及如何使用它们。有没有办法让Java分析库在Rascal REPL中工作?
我有Cygwin,安装版本2.8473,64位。我安装了gcc-g++。我正在尝试安装SDL2,同时尝试SDL-2-2.0.3和SDL-2-2.0.4。我将讨论2.0.3的问题,因为这是稳定版本。
我,我应该运行/usr/bin/set-gcc-默认-3.sh,但它不在那里。(gcc似乎已经安装了,因为我在SDL-2-2.0.3目录中运行make时看到了它的工作。)我一直无法通过搜索互联网找到它的来源--也许这就是它?没有它,make给了我这些抱怨:
Warning, configure.in is out of date
许多“静态声明”错误如下:
.../SDL_render_d3d11.
我正在尝试在运行Windows 7 Service Pack 1的系统上安装Visual Studio Community 2015 Update 1。但是,在安装开始之前,我收到了一条错误消息,显示“指定的程序需要更新版本的Windows”。
我的理解是,Visual Studio Community 2015与安装了SP1的Windows7兼容,所以我不确定为什么会出现这个错误。
函数应该使用指针算法(而不是数组下标)。换句话说,消除循环索引变量和函数中所有[]运算符的使用。
void set_complement(int *a, int n, int *complement)
{
//pointers and variables declaration
int i;
int *Pa = a;
int *Pc = complement;
for(i = 0; i < n; i++)
{
if( *(Pa + i) ==
我试图通过命令行在Windows上运行Rascal,命令在上给出,但我得到了以下异常:
$ java -Xmx1G -Xss32m -jar rascal-0.18.2.jar
Version: 0.18.2
INFO: detected |lib://rascal| at |jar+file:///D:/workspace/mach/delphi2java/lib/rascal-0.18.2.jar!/|
unexpected error: Unexpected error in Rascal interpreter: Could not find an installed System
我只想在VBscript中调用自定义元素的函数。以下是我当前的脚本代码。但是它使我的应用程序崩溃了。(目标浏览器是internet explorer)
Function SampleFunction()
msgbox"samplemessage"
End Function
set ResponseFn = getRef("SampleFunction")
set element = document.getElementById("elem id")
element.addEventListener "OnResp