eclipse-xtext / eclipse-xtext/xtext
Cannot assign 'STRING' text to a field.
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 831
- Forks
- 330
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 12
Description
Steps to reproduce:
-
Create a new Xtext project with the Xtext new project wizard.
-
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';
-
Execute the
GenerateMyDsl.mwe2workflow. -
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(", ")»''')
}
- The test case will fail with the error message:
Unexpected errors: XtextSyntaxDiagnostic: null:1 String literal is not properly closed
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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