xtext and xtend « punctuation mark, how do I get it? - xtext

I'm trying to add these punctuation mark things to XTend to define my generator for a custom language written in XText. I'm getting very sick of copy/pasting the « quotation/punctuation mark all over the place. Originally I copied it from one of their examples.
How in the world do I TYPE this mark? I'm in the eclipse IDE... any help would be great, I've searched all over the web for this.

Actually with Eclipse I'm finding that CTRL+SHIFT+< is what works. This is with Eclipse Oxygen, maybe you're on another version.

within eclipse you can use Crtl+Space or Crtl+< within a Rich String ('''''') to get the Guillemets

Related

Autocomplete punctuation using grammar

I'm working on a tool that is able to autocomplete the necessary literals defined in a grammar. For example: in C# if a programmer enters: for with a space after it, then it's entirely possible to parse the code, determine that the programmer has started a for statement and autocomplete the necessary punctuation: ( ; ; ).
The more I think about the problem, the more I think there must already be a solution for it, because it's such a common use case, but I can't find anything.
Is there a tool that can do this using a given grammar?
If you don't mind using ANTLR v3 instead of v4 you can use Xtext in order to generate an editor that features auto-complete and error-highlighting. This will happen in form of a plugin for eclipse and apparently also for IntelliJ IDEA.
If you want to use a different IDE or simply want to make use of ANTLR v4's powerfull features you could still have a look at the Xtext Sources as they have to do what you are searching for in order to provide the above mentioned features properly...
This package looks very promising at first glance... You might find the respective code in there.
Be aware though that Xtext is mainly written with Xtend so you either have to do so as well or you have to rewrite it a bit

How to get type info from Go compiled packages in language x?

I want to write a simple editor with basic autocomplete functionality for the Go language as a pet project. How would one go about doing it? I took a look at the Go plugins for Eclipse and IntelliJ, but they were too big for me to comprehend (not to mention getting one to compile).
The Go standard library offers the building blocks for a Go parser which
you can use to parse the source files and look for function definitions and the like.
There's also the godoc command which
already does what you want: extracting method definitions and it's documentation. You may look in the
source code to see how godoc is
working or use godoc directly.
This editor written in Go projects has a manageable amount of code,
you may look into it.
The de facto standard approach to this problem is to use nsf's gocode. I have tried it only in Vim - it works very well.
Even though there's ready made support for specific editors, gocode is not editor specific. It's a daemon with a communication protocol. It is thus usable from any program.

Does Brackets (editor) have bundles like textmate

I just downloaded brackets after hearing recent buzz about the editor. There are some really cool / useful features out of the box.
Alot of my projects use templating engines, like twig. Does this editor support bundles for other filetypes? I have been using textmate for a while and by simply downloading the twig bundle I have highlighting and code snippets integrated into the editor. I am hoping brackets has a similar feature.
The short answer is: not yet, but soon.
Longer answer:
APIs for Brackets extensions to add a new syntax/language are currently in progress, and will probably be done in about a month.
Since Brackets uses the CodeMirror editor, syntax highlighting is driven by CodeMirror "modes." It doesn't appear that anyone has made a Twig mode yet. But it might not be too hard to build one, either based on the sample code for Mustache highlighting or the new "multiplexing mode" feature in CodeMirror 3 (Brackets is updating to CodeMirror 3 soon).
Brackets may eventually support directly importing TextMate language bundles, like Sublime does, but that's a ways off.
As a stopgap, you could have Brackets just highlight Twig files as plain HTML -- better than no color coding at all. That'll be doable with the upcoming extension APIs, but if you're feeling adventurous you could hack your current copy of Brackets to do that right now. Just dig into the app folder, open www/editor/EditorUtils.js, and add the file extension after the case "html": line.
(p.s. - I work on the Brackets core team. Thanks for giving Brackets a try!)

How to print Smalltalk code from Pharo/Squeak?

What is the best way to print - syntax colored and well formatted - code from Pharo/Squeak on paper?
1) Is there a way to print directly from within Pharo/Squeak? (i use it on macosx)
2) Is there a way to export syntax colored, well formatted code from Pharo/Squak?
3) Are there external tools to color and format a filed out piece of code?
For the appendix in my master thesis I used the Pier CMS-to-LaTeX converter in the Pier-Documentation package. However, this plugin only takes class comments and method comments into consideration, it does not print the source code. Pier also provides a package ShoutPier for syntax highlighting of Smalltalk code, so I guess it would require little work to bring the two together. You can find the mentioned extension packages in http://source.lukas-renggli.ch/pieraddons.html.
Pharo browsers seem to use syntax highlighting.
What difficulty are you having reading Smalltalk code using the browsers and senders/implementors ?
Edit: Would something that produces UML give the overview you're looking for? The Dandelion website only shows downloads for old Squeak versions - I don't know if they would work with Pharo.
And perhaps this GSoC project "Generate UML diagrams from Smalltalk code for Pharo" suggests not.
Here's how I did it on my Mac, I think this should work on other platforms too.
Save your categories to a Monticello local folder on your disk -- see the Pharo manual on how to do this: http://book.pharo-project.org/book/PharoTools/Monticello/?_s=hdGOLc_FXsvVY1iR&_k=YYH-Ln8f5mtWZ8z2&_n&148
Browse to this folder, and unzip the .mcz file
You'll see all your code in snapshot/source.st file
You'll need to edit this a bit, to remove the ! characters for e.g., there might be a tool to do this?
-Eric.
There is webdoc project, which allows you navigating code in web browser:
http://ss3.gemstone.com/ss/webdoc.html
(and of course you can print code from your favorite web browser)..
1) Install shout from www.squeaksource.com
2) I don't know. May be you can customize shout.
3) In gnu-smalltalk you have a smalltalk mode for emacs. But I am not pretty sure to understand what you are looking for.

simple search engine

I am trying to write program its like a simple search engine, in this program the user is supposed to enter a search keyword into an edit box and then he can click the search button, and the program is supposed to open a specific text file from the directory and find a matching word to that keyword in this text file. I am using Delphi 2007. thank you
Basically you need to find a string in another string. Take a look at this algorithm: http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm
If you are on a unix system, send a call to grep. If you are on a windows system, install grep for windows.
You might want to look at the source code for the open source project GExperts. It contains a text search engine (grep) that works very well.
I have written something similar in C# - Searcharoo.net - you can download the source code from there.
What might be more useful, though, are the articles that I wrote describing how it works... This description of how Version 1 might be of some use - although I'm probably biased since I wrote it (back in 2004).
Your question is pretty open so I'm not sure if this will help - particularly since I don't know Delphi and how different it is to C# - but hope it helps...

Resources