我创造了一种语言"在xtext中,可以使用" MWE2 Workflow"生成而不会出错。我也可以为特定语言启动一个eclipse新实例并创建一个文件。第一行也没问题,但是当我尝试添加另一行时,这个eclipse实例不再重复几秒钟/几分钟并发生错误:
提示:
Unhandled event loop exception
Java heap space
堆栈跟踪:
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.util.ArrayList.toArray(Unknown Source)
at java.util.ArrayList.<init>(Unknown Source)
at com.google.common.collect.Lists.newArrayList(Lists.java:128)
at org.eclipse.xtext.ui.editor.model.DocumentTokenSource.setTokens(DocumentTokenSource.java:217)
at org.eclipse.xtext.ui.editor.model.DocumentTokenSource.computeDamageRegion(DocumentTokenSource.java:327)
at org.eclipse.xtext.ui.editor.model.DocumentTokenSource.updateStructure(DocumentTokenSource.java:249)
at org.eclipse.xtext.ui.editor.model.XtextDocument.fireDocumentChanged(XtextDocument.java:700)
at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1191)
at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1210)
at org.eclipse.jface.text.DefaultDocumentAdapter.replaceTextRange(DefaultDocumentAdapter.java:248)
at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7268)
at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:8111)
at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2481)
at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5955)
at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5986)
at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5663)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1070)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1112)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1108)
at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1529)
at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4722)
at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:343)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4610)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5023)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549)
会话数据:
eclipse.buildId=4.4.2.M20150204-1700
java.version=1.8.0_31
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments: -product org.eclipse.platform.ide
Command-line arguments: -product org.eclipse.platform.ide -data <path>/../xtext_craass -dev <path>/emf/.metadata/.plugins/org.eclipse.pde.core/Eclipse CraAss Runtime/dev.properties -os win32 -ws win32 -arch x86_64
有一些(很少)类似的&#34;主题&#34;,但到目前为止我可以看到,它们似乎是不同的问题:
也许我在xtext文件中犯了错误:
grammar org.bs.craass.CraAss
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
generate craAss "http://www.bs.org/craass/CraAss"
CraAss:
functions += CAFunction*
main = CAMain
functions += CAFunction*;
CAMain:
'main'
commands += CACommand+
'done';
CAFunction:
'def' name=FUNCTION_TERMINAL
params += CAParam*
'body'
commands += CACommand+
'done';
CAParam:
'param' name=CAVariable;
CACommand:
CADec | CALoad | CAMov
| CAAdd | CASub | CAMul | CADiv
| CARead | CAPrint | CAPrintln
| CACall;
CACall:
'call' method=FUNCTION_TERMINAL params+=VAR_TERMINAL*;
CADec:
'dec' name=CAVariable;
CALoad:
'load' to=CACaches ',' value=INTEGER;
CAMov:
'mov' to=CACaches "," from=CACaches;
CAAdd:
'add' op1=CACaches "," op2=CACaches;
CASub:
'sub' op1=CACaches "," op2=CACaches;
CAMul:
'mul' op1=CACaches "," op2=CACaches;
CADiv:
'div' op1=CACaches "," op2=CACaches;
CARead:
'read' object=CARegister;
CAPrint:
'print' object=CARegister;
CAPrintln:
'println' object=CARegister;
CACaches:
(CAVariable | CARegister);
CAVariable:
dec=VAR_TERMINAL;
CARegister:
dec=REGISTER_TERMINAL;
terminal INTEGER : '-'?('0'..'9')+;
terminal VAR_TERMINAL : '_' ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
terminal REGISTER_TERMINAL : ('ax' | 'bx' );
terminal FUNCTION_TERMINAL : (('a'..'z'|'_'|'0'..'9')*'.')?('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
希望有人可以帮助我或知道问题。
答案 0 :(得分:1)
经过一些工作,从构造从错误语法到工作语法。我找到了一个(可能的)麻烦制造者。我需要以下一行:
terminal WS : (' '|'\t'|'\r'|'\n')+;
解决了OutOfMemoryError问题,但对我来说似乎很奇怪。错过了这个,导致了这样的错误。添加此行后,语法仍然无法使用,并显示错误,例如'\ t'是意外的。这将是我预期的错误,错过了这个终端(但不是异常,从来没有错误)。当我使用隐藏(WS)时,语法变得可用。是的,它是从org.eclipse.xtext.common.Terminals复制的。在我没有达到目的之前,隐藏着(......)的是什么。
但到目前为止,这是帮助。
最后一点是,如果这应该是xtext的错误票。
答案 1 :(得分:0)
看起来你的Java已经用完了Heap space 此问题的解决方案是增加JVM启动时的堆大小。为此,您需要使用启动参数-xmx 您必须在您正在启动的eclipse应用程序的Run-configurations中设置此参数。