eclipse-xtext / eclipse-xtext/xtext

Cannot assign 'STRING' text to a field.

Open
#3,640 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
831
Forks
330
Avg merge
3d 7h
Merged PRs (30d)
12

Description

Steps to reproduce:

  1. Create a new Xtext project with the Xtext new project wizard.

  2. Modify the grammar to

	grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals

	generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"

	Model:
		a = 'STRING';
  1. Execute the GenerateMyDsl.mwe2 workflow.

  2. Modify the generated loadModel() test case in the MyDslParsingTest.xtend file to

	@Test
	def void loadModel() {
		val result = parseHelper.parse('''
			STRING
		''')
		Assertions.assertNotNull(result)
		println(result.a)
		val errors = result.eResource.errors
		Assertions.assertTrue(errors.isEmpty, '''Unexpected errors: «errors.join(", ")»''')
	}
  1. The test case will fail with the error message: Unexpected errors: XtextSyntaxDiagnostic: null:1 String literal is not properly closed

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the grammar shown in the issue, the generated GenerateMyDsl.mwe2 workflow, and MyDslParsingTest.xtend. Run the generated loadModel() test with the literal STRING input and inspect the reported syntax diagnostic. Done means the test parses STRING without the "String literal is not properly closed" error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.