Skip to main content



      Home
Home » Modeling » TMF (Xtext) » How can I override STRING?
How can I override STRING? [message #1831536] Sat, 22 August 2020 02:13 Go to next message
Eclipse UserFriend
In my project,I need override STRING. I'm going to replace double quotes with single quotes.(eg: 'helloworld')
I tried to write a rule, but I failed!
index.php/fa/38803/0/

Can anyone help me ??

Thanks a lot!

  • Attachment: 1.png
    (Size: 43.96KB, Downloaded 185 times)
  • Attachment: 1.png
    (Size: 43.96KB, Downloaded 73 times)
Re: How can I override STRING? [message #1831539 is a reply to message #1831536] Sat, 22 August 2020 04:15 Go to previous messageGo to next message
Eclipse UserFriend
the .? makes no sense. its just one char.
is there any reason you don use -> as in the comment rule or just copy the one half of the overriden STRING rule from terminals?

"'" ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|"'") )* "'
Re: How can I override STRING? [message #1831543 is a reply to message #1831539] Sat, 22 August 2020 06:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi

You partially override builtins by deleting the grammar 'inheritance' from org.eclipse.xtext.common.Terminals.

You can then duplicate as much of org.eclipse.xtext.common.Terminals as you want in your own grammar with whatever changes you feel appropriate.

However this is only a partial override since beware that certain terminal such as ID have built-in functionality.

Regards

Ed Willink
Re: How can I override STRING? [message #1831544 is a reply to message #1831539] Sat, 22 August 2020 06:35 Go to previous message
Eclipse UserFriend
Thanks for your advice!
I resovled this problem.
Previous Topic:Maven build fails when using my own XtextGenerator
Next Topic:Extend xbase with a more expressive range
Goto Forum:
  


Current Time: Tue Jul 01 09:01:30 EDT 2025

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

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

Back to the top