Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Override SL_COMMENT(Parsing comments)
Override SL_COMMENT [message #1843578] Mon, 09 August 2021 11:40
Frä Fröhlich is currently offline Frä FröhlichFriend
Messages: 22
Registered: June 2021
Junior Member
I am trying to intoduce Java Modeling Language (JML) in my project.
They use annotations in comments (e.g. /* @requires ... */)
I override(?!) the hidden symbols in my grammar:
grammar de.tu_bs.cs.isf.cbc.textual.tool.Dsl with  jbase.Jbase hidden(WS, SL_COMMENT)

Then I have a rule
JMLAnnotation returns JMLAnnotation:
	'/*'( ID
//	 ("*"* "@requires" requires=JMLExpression ";") &
//	 ("*"* "@ensures" ensures=JMLExpression  ";") 
	)-> '/*'

I commented out the "complicated" part and currently I am trying to get a simple ID in between the comment section.
However, on execution of /* foo */ I get:
mismatched input '/*foo */' expecting '/*'

So the parser recognized the comment and didn't skip it, but I couldn't get an example working with this.
Previous Topic:Xpand or Xtext function NOCODE
Next Topic:Context Validation
Goto Forum:

Current Time: Wed Feb 01 17:00:10 GMT 2023

Powered by FUDForum. Page generated in 0.02230 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top