Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Override SL_COMMENT(Parsing comments)
Override SL_COMMENT [message #1843578] Mon, 09 August 2021 07:40
Eclipse UserFriend
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: Sun Jul 06 05:14:58 EDT 2025

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

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

Back to the top