Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Handling of backslash
Handling of backslash [message #1848969] Mon, 27 December 2021 14:29 Go to next message
Akira Tanaka is currently offline Akira TanakaFriend
Messages: 96
Registered: March 2010
Member
Dear all,

I am working on an Xtext project whose target/instance model is an XML document. When creating a model (XML document), it needs to accept a string including backslash (\), and this backslash is not an escape character. For instance, the XML document may contain something like below.
...
<script>
abc\def
</script>
...

Is it possible to define an Xtext grammar that supports above?

I would appreciate any advice.

Thank you very much in advance.
Re: Handling of backslash [message #1848973 is a reply to message #1848969] Mon, 27 December 2021 17:42 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7468
Registered: July 2009
Senior Member
Hi

Yes.

If you don;'t like the half-built-in STRING token typically imposed by Terminal.xtext, redefine it or define a different token.

Make sure you define a suitable replacement for e.g. DoubleQuotedStringConverter that doesn't interpret backslash, but probably does support &gt; etc. You may find suitable encode/decode utility routines perhaps in the EMF XML support, perhaps in the SAX parser.

Regards

Ed Willink
Previous Topic:Defined 2-way link-list xtext grammar issues
Next Topic:Log4j 1.x updates to Log4j2
Goto Forum:
  


Current Time: Thu May 26 02:29:53 GMT 2022

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

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

Back to the top