The followings are my grammar rules:
Stmts: (stmts += Stmt ';')* ;
Stmt: Stmt1 | Stmt2 | Stmt3 ... ;
I want to know each Stmt# is #-th stmt in stmts and their exactly location (#-th line in original document). Such that I could point out the location when user make mistakes.
I override the validator constructor and store an HashMap <Stmt, Integer>
to get each Stmt# is the #-th Stmt in stmts(Not sure if this is the correct way to do though...). However I have no idea how to get their line number.
Any help?
From the settings menu scroll down to the Accounts section and tap on Google. In the next menu tap on Location settings. On the final location access page swipe the Off button to On. This will allow all of Google's Android apps installed on your phone to access your GPS location.
Given an EObject you can easily get the position in the source file using org.eclipse.xtext.nodemodel.util.NodeModelUtils.getNode(EObject)
.
For example:
INode node = NodeModelUtils.getNode(o);
System.out.println(String.format("Node goes from line %s to line %s",node.getStartLine(), node.getEndLine()));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With