Menu
  • HOME
  • TAGS

how to fix a simple error on xtext?

Tag: eclipse,compiler-errors,uml,dsl,xtext

this is my example to show you the problem I need to call two rules

generate umlDsl "http://www.xtext.org/example/umldsl/UmlDsl"

Model:
elements+=rule*
;
rule:
   rul1 'and' rul2
;

rul1:
   'rul1' action1=[uml::Action|FQN]
;                       

rul2:
    'rul2' action2=[uml::Action|FQN]
;

FQN returns ecore::EString:
   ID ("." ID)*
;

I have this error

Multiple markers at this line (rul1 'and' rul2)

  1. An unassigned rule call is not allowed, when the 'current' was already created.
  2. Cannot change type twice within a rule

I want to know why I have this error and how to fix it please

Best How To :

These errors occurs because of your rule implementation of rule rule

rule:
   rul1 'and' rul2
;

As I understand rule has two attributes, rul1 and rul2. But in your implementation rule does not have any attributes. To define rul1 and rul2 as attribuites you have assign these elements to an attribute. This could look like this:

rule:
   rul1=rul1 'and' rul2=rul2
;

Have you looked into the Xtext documentation [1] to learn about the grammar language syntax and semantics?

The things you need to know for understanding your error are the following:

An attribute of a parser rule needs a name. To this name you assign a value, which is an other parser rules name. It is similar to assing values to a field in Java:

int i = 42;

A field declaration consists of the fields type (int) and the fields name (i) this normally is followd by the assignment operator (=) and the value (42). The attribute definiton of a parser rule follows this scheme:

RuleA: 'some syntax' attributeName=OtherRule 'more syntax';
OtherRule: 'other syntax' attribute=NextRule ... ;
...

A parser rule in Xtexts grammar language is like a Java class. RuleName corresponds to class ClassName. Then you can define some static syntax with 'keyword'. If any other rule should occur within any other rule, it can be understood as a field declaration. This rule is an attribute which is implemented like this:

attributeName=AnyRule

Where attributeName corresponds to the field name. But to an attribute the type of the value is assigned (AnyRule).

Btw. I strongly recommand that rule names should start with an Capital letter and attribute names should start with an lower case letter.

[1] https://www.eclipse.org/Xtext/documentation/301_grammarlanguage.html

IntelliJ - use imported modules as dependencies like maven projects in Eclipse

eclipse,scala,maven,intellij-idea,sbt

It should work out of box for dependencies, which are imported to the project as modules, no additional settings needed. At least for Java. Just do not run a Maven goal, that would use dependencies from the repository. ...

Modify ivy classpath entry

java,eclipse,eclipse-plugin,ivy,ivyde

With the project, you can get all the class path entries. I went through and excludes the ivy entries. Then I re-added them with the correct class path and property files. Now, the paths do not include ${ivyproject_loc} and ${project_loc}. Here is the code: protected void changeIvyClasspath(IProject project, IProgressMonitor monitor)...

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver [Eclipse, Tomcat]

java,mysql,eclipse,tomcat,jdbc

It should be in your Webcontent/WEB-INF/lib folder not Webcontent/META-INF/lib

Android Fullscreen codes not working

java,android,eclipse

To show app in fullscreen use: getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); To remove it use: getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); ...

Not Able to consume external RestFul web service from Client in Eclipse or from restclient-ui

java,eclipse,web-services,restful-url,rest-client

Try setting your company's proxy using: System.getProperties().put("https.proxyHost", "proxyHost"); System.getProperties().put("https.proxyPort", "proxyPort"); Similarly for http....

one eclipse install not displaying utf8

java,eclipse,svn,utf-8

Workspace-wide encoding is configured here (Windows -> Preferences -> General -> Workspace): If it is not working as expected, the project probably overrides the settings (Right click on project -> Properties -> Resources): ...

How to throw an error in the LESS compiler

css,compiler-errors,less,throw,less-mixins

Suggested, but strictly not recommended solution by Harry .col-fixed(@size, @count, @wrapper) { & when ((@size*@count) <= @wrapper) { width: unit(@size, px); margin-right: unit( (@wrapper - @count * @size) / (@count - 1), px); } & when ((@size*@count) > @wrapper) { /* there is no such variable and hence when the...

guidance needed on using apache commons math

java,eclipse,apache

It may be so simple that you haven't imported the DescriptiveStatistics class. Put this in the top of your file: import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; ...

What are my next steps on finding the cause of this exception?

java,android,eclipse,debugging

I step through the code as the application is running on the Android device but the exception occurs in code that is not part of the application As you've done, step through your application code line by line in a debugger, until you get to the last line which...

JSF facets not available in Eclipse

java,eclipse,jsf,facets

That can happen if you started with plain "Eclipse IDE for Java Developers" instead of with "Eclipse IDE for Java EE Developers" and then manually added some plugins on it. Throw away your current Eclipse install and restart clean with "Eclipse IDE for Java EE Developers".

Eclipse Layout: static instead of relative values?

android,eclipse,layout

<LinearLayout android:orientation=horizontal android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:orientation=horizontal android:layout_width="0" android:weight="50" android:layout_height="match_parent"> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="75dp" android:gravity="center" android:text="Button" /> </LinearLayout> <LinearLayout android:orientation=horizontal android:layout_width="0"...

No hello World output for Neo4j

java,eclipse,neo4j

That example creates and then deletes the data so that is one reason why your graph is empty. Another observation is your DB_PATH. If you've set DB_PATH='data/graph.db', then that path is relative to your project path. If your code is located in /projects/example then this embedded database should be created...

Match string in XText regardless of upper/lower case

java,eclipse,pattern-matching,dsl,xtext

There is a flag that you can configure in the mwe2 workflow. Replace the XtextAntlrGeneratorFragment by the org.eclipse.xtext.generator.parser.antlr.ex.rt.AntlrGeneratorFragment and pass options = { ignoreCase = true }. Same for the XtextAntlrUiGeneratorFragment and the org.eclipse.xtext.generator.parser.antlr.ex.ca.ContentAssistParserGeneratorFragment

Eclipse not compiling because of ClassNotFoundException

java,eclipse,amazon-web-services,compilation,aspectj

It seems that your Eclipse doesn't found the library of aspectj. Try to download it again from: https://eclipse.org/aspectj/downloads.php By your stack trace I suppose that the version of aspectj that it is looking for it's the 1.6 so I suppose that you have to search the package in which puts...

Meaning of connectionTimeout in tomcat

java,eclipse,tomcat

Taken from here: https://tomcat.apache.org/tomcat-7.0-doc/config/http.html connectionTimeout The number of milliseconds this Connector will wait, after accepting a connection, for the request URI line to be presented. Use a value of -1 to indicate no (i.e. infinite) timeout. The default value is 60000 (i.e. 60 seconds) but note that the standard server.xml...

BIRT Report Client or Server Side Filtering?

eclipse,birt

Yes this visibility property is filtering elements on server-side, so it is secured in your case. As far as i know there is only one BIRT property acting as a sort of client-side filter: this is the "General -> display" property (block | inline | No display). However for performance...

Remote debugging tomcat with OpenShift

eclipse,tomcat,openshift,remote-debugging

You should read through the Developer Portal's pages on Port Forwarding (https://developers.openshift.com/en/managing-port-forwarding.html) to make sure that you are using it correctly. You will want to connect to your local loopback address: 127.0.0.1 along with the correct forwarded port once you have run the port-forwarding command.

Multiple definition and file management

c,arrays,compilation,compiler-errors,include

include is a preprocessor directive that includes the contents of the file named at compile time. The code that conditionally includes stuff is executed at run time...not compile time. So both files are being compiled in. ( You're also including each file twice, once in the main function and once...

html form action not working when using eclipse

java,eclipse,jsp,servlets

Try to delete the comment // @WebServlet("/hello"), and put @WebServlet("/hello"). Stop the server, refresh and if its necessary clean it. And re - launch again. And take a look if the web.xml the welcome file list is correctly, because is the file which launch always.

Unfortunately, (My app) has stopped. Eclipse Android [duplicate]

java,android,eclipse,adt

In your MainActivity.java at line no 34 you are trying to initialize some widget that is not present in your xml layout which you have set it in your setContentView(R.layout.... That;s why you are geting nullpointerexception. EDIT: change your setContentView(R.layout.activity_main) to setContentView(R.layout.fragment_main)...

Stop git from bringing changes to master into my branch?

eclipse,git

So the problem here is that MYBRANCH is set up to track origin/master, which means that when you do a git pull, origin/master will be merged into it. You can untrack it by doing git config --unset branch.MYBRANCH.merge. Assuming there is an origin/MYBRANCH, you can track it by doing git...

Importing Spring MVC Project Manually to Eclipse

java,eclipse,spring,spring-mvc

you will extract zip file and go to inside folder in templete.zip is import succesully into eclipse IDE.i have tested.

setting objects equal to eachother (java)

java,methods,compiler-errors,equals

There are two ways to interpret "set the objects equal to each other". One is that you want p1 and p3 to refer to the same object. Like how Clark Kent and Superman are two names (references) for the same person. This would be accomplished by: Person p1 = new...

Mysterious claim of a missing { in eclipse

java,eclipse

In Java, you cannot write executable statements directly in class.So this is syntactically wrong: for(int i=0; i<10; i++) { this.colorList[i] = this.allColors[this.r.nextInt(this.allColors.length)]; } Executable statements can only be in methods/constructors/code blocks...

Eclipse Debugger Hitting Comments, Skipping Actual Code

eclipse,debugging

This happens when you source code is out of sync with class files that are being executed in the VM. To correct this Do a clean build. Deploy your changes (i.e. make sure the class file you built are copied to the execution environment). Re-start your debug session. The debug...

UISpec4J tests in Eclipse are not found

java,eclipse,user-interface,testing,uispec4j

just for fun. you can remove "extends UISpecTestCase" in your class and give it a try see if it works or not :) Junit 4.X should support annotation well and I didn't see any reason you need to extends UISpecTestCase....

Eclipse CDT shows … not resolved errors for ARM neon intrinsics, but produces the binary

c++,eclipse,arm,neon

Change: #include "arm_neon.h" to: #include <arm_neon.h> Watch out for this in future - often <> and "" are interchangeable, but in some cases it can make an important difference. Always use <> for system headers and "" for user headers....

Can't reference a variable from App.config

c#,compiler-errors,app-config

Use the system.configuration class. string str = System.Configuration.ConfigurationManager .AppSettings["someAppSetting"] .ToString(); ...

Can I install 2 or more Android SDK when using Eclipse

java,android,eclipse,sdk,versions

There shouldn't be any problem if you use the latest SDK version ; actually, this is recommended. However, make sure to set the correct "Target SDK", i.e. the highest android version you have successfully tested your app with, and the "Minimum Required SDK" as well....

Eclipse CDT - No Console Output on OSX

c++,eclipse,osx,terminal,64bit

Are you using the right compiler? If you are compiling with Cross GCC it might not run on a 64bit OS X device. Try using MacOS GCC for compiling if so.

How to change Eclipse IDE GUI icons?

eclipse,user-interface,icons

Most of the icons seem to be stored under \eclipse\configuration\org.eclipse.osgi\bundles\684\1.cp\icons AND in other folders of \eclipse\configuration\org.eclipse.osgi\bundles. I don't know if the license of Eclipse allows you to change that just check that out, and if you can, you can either change/create them yourself or you can search for icon packs...

Open a properties file from a class in a Dynamic Web Project

java,eclipse,jsp,properties-file

You can put this propertie file within your java package for example com/test and use following: getClass().getResourceAsStream( "com/test/myfile.propertie"); Hope it helps....

Match a pattern preceded by a specific pattern without using a lookbehind

regex,eclipse,lookahead

A work-around for the lack of variable-length lookbehind is available in situations when your strings have a relatively small fixed upper limit on their length. For example, if you know that strings are at most 100 characters long, you could use {0,100} in place of * or {1,100} in place...

Java: unhandled exception

java,eclipse,exception,exception-handling,try-catch

The issue is caused by the lambda function. The interface of the function that forEach requires doesn't declare any kind of checked exceptions: take a look at java.util.function.Consumer. That's the place where the first issue occurs, the second one is simply a result of the first one. Either you should...

Scala running issue on eclipse

eclipse,scala

to run as scala application, you need to create Scala App and not class In eclipse, package explorer select project/src/package right click new>scala app inform Name e.g. Test and click "finish" select Test.scala right click "run as Scala Application" see results in console window....

Spring Roo Shell in Eclipse: Could not create sts.roo.ui.rooShellView

eclipse,spring-roo,spring-tool-suite

As you can see here, current version of Spring IDE Roo Support plugin has no support to load Spring Roo version higher than 1.2.1. This is already fixed in new plugin version that will be released with STS 3.7.0 which is scheduled for end of June/early July. Until that, you...

Call to implicitly-deleted copy constructor in LLVM(Porting code from windows to mac)

c++,osx,c++11,compiler-errors,llvm

This line of code is very ambiguous: for (auto it : _unhandledFiles)//ERROR HERE auto uses template argument deduction, so std::string s; std::string& sr = sr; auto x = sr; in the above code x is deduced to be of type std::string, not std::string&. So your loop is equivalent to: for...

Why does Eclipse reference a 1.4 JRE?

java,eclipse

As @Marvin mentioned in the comments above, Eclipse Juno is not compatible with JDK 1.8. It might be a bug that Eclipse interprets JDK 1.8 as 1.4, but I suspect you can work around it by either removing the 1.8 from your list of installed JREs or updating to a...

apply formatter only on edited code - eclipse [duplicate]

java,eclipse,save,formatter

Yes, under preferences: Java -> Editor -> Save Actions "Perform the selected actions on save" -> "Format source code" -> Change from "Format all lines" to "Format edited lines"...

exec-maven-plugin error, even on working example

java,eclipse,maven

The error log which you posted says the following: java.lang.ClassNotFoundException com.jadex.qna.QNAProject.App So it clear what the root source of the error is. You are trying to execute the main() method of a class whose class file Maven cannot find. As this SO article discusses, you can try explicitly compiling first,...

How to find references to a class that's referenced indirectly via exported jar in Eclipse?

java,eclipse

For a plug-in project, all of its dependencies have to be from other plug-ins and declared using its MANIFEST.MF file. Being packaged in a .jar has nothing to do with it. At runtime, the stated dependencies are wired by Equinox. At development time, PDE uses your MANIFEST.MF to set up...

Showing previous searches in PyCharm

eclipse,full-text-search,pycharm

When View tool window is active (View -> Tool Windows -> Find (Alt+3)) there's Recent find usages (Ctrl+E) option in the context menu. It seems Pycharm does not remember excluded results, though.

How to force team members to comment using eclipse plugin or something else

eclipse,jenkins,eclipse-plugin,coding-style,build-automation

You can run static code checks and their corresponding eclipse plug-ins to enforce comments being made in code. For e.g. in CheckStyle javadoc can be enforced http://checkstyle.sourceforge.net/config_javadoc.html Also checkstyle can be easily integrated with Jenkins. You can also use eclipse java compiler settings for javadoc check. Go to preferences->java->compiler->javadoc to...

Disable Wrapping Cursor in Eclipse

eclipse,vim,vi

In Vim, the behavior of the arrows when the cursor is at the BOL/EOL is governed by the 'whichwrap' option which — judging by the manual — is not supported by viPlugin. What you want would be achievable with custom mappings and a bit of vimscript logic in Vim itself...

How to save a json file locally with dojo toolkit

javascript,android,json,eclipse,dojo

Why use dojo? You can use javascript and HTML5

Compilation Error on maven

java,eclipse,maven,maven-plugin

Check with that below dependency is it present or not ?? <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> <version>2.0-m01</version> </dependency> ...

Close module in android studio

android,eclipse,android-studio

There is no notion of opening and closing a module in Android Studio. There should be no need to do it. You seem to be treating an Android Studio project as being the equivalent of an Eclipse workspace, and IMHO that is not a valid comparison....

Java eclipse I want to open the form like tab [on hold]

java,eclipse

You want to make your program look like that? With tabs? If that's the case, use a tabbed pane. link: https://docs.oracle.com/javase/tutorial/uiswing/components/tabbedpane.html...

Tomcat 7 PermGen Space or Failed to Create JVM

java,eclipse,tomcat,tomcat7,permgen

Problem solved : Downloaded a new Tomcat (7.0.62) : https://tomcat.apache.org/download-70.cgi Added Arguments at the launch of my Tomcat : -Xms256m -Xmx512m -XX:MaxPermSize=128m ...

WebDriver Selenium browse file Java

java,eclipse,junit,webdriver

From the screenshot you have given, I can see the concerned element is in an iframe. (Check the second bar in the developer tools below the bar containing: Inspector, Console,etc. You will note the iframe#iframe_1434526152814_57_7. ). Hence, you weren't able to send the path to it. In order to send...