Wanted: Oberon Syntax in TextMate, Sublime Text or Atom Grammar
Does somebody have grammars for Oberon / Oberon-2 / Component Pascal / Active Oberon as grammar for TextMate / Sublime Text / Atom Background: Github wrongly classifies Oberon / Oberon-2 / Component Pascal / Active Oberon as Modula-2. I opened quite some tiome ago an issue in the github/linguist project (https://github.com/github/linguist/issues/3888) and they don't accept EBNF grammars. -- Bernhard Treutwein
Hi Bernhard,
Background: Github wrongly classifies Oberon / Oberon-2 / Component Pascal / Active Oberon as Modula-2...(https://github.com/github/linguist/issues/3888)
I'm using this extension in Visual Studio Code (I don't like the colours, but let's not be subjective). ;-) https://marketplace.visualstudio.com/items?itemName=colbyrussell.vscode-ober... But I have no idea how to recover the syntax from the .vsix file. I read and appreciate your efforts in 3888 to get something done about this, and I see the problem - nothing is easy, right? Maybe the only way would be to classify .Mod files as "Modula-2/Oberon" as a starting point - but that might break something with the Modula-2 people. But how are dialects handled anyway, I wonder? Certainly, I think it's pretty clear now that in computing, there's no such thing as a truly "dead" language. :) Cheers, Paul
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Paul Reed Sent: Saturday, 28 July 2018 8:20 PM To: ETH Oberon and related systems Subject: Re: [Oberon] Wanted: Oberon Syntax in TextMate, Sublime Text or Atom Grammar
Hi Bernhard,
Background: Github wrongly classifies Oberon / Oberon-2 / Component Pascal / Active Oberon as Modula-2...(https://github.com/github/linguist/issues/3888)
I'm using this extension in Visual Studio Code (I don't like the colours, but let's not be subjective). ;-)
https://marketplace.visualstudio.com/items?itemName=colbyrussell.vsco de-oberon-support
But I have no idea how to recover the syntax from the .vsix file.
.vsix is an installer. When you run it the VS Code extensions are javascript / json files are stored in the Users\<username>\.vscode\extensions folder. I was underwhelmed by Colby Russell's efforts when I checked it out a while back. If anybody wants to explore this further I would recommend using one of the existing Pascal language extensions as a starting point. There is some more information on this topic in a discussion titled 'Editing M2 on Visual Studio Code, anyone?' last month on comp.lang.modula2. Regards, Chris Chris Burrows CFB Software http://www.astrobe.com/
On 07/28/2018 05:50 AM, Paul Reed wrote:
I'm using this extension in Visual Studio Code (I don't like the colours, but let's not be subjective). ;-)
https://marketplace.visualstudio.com/items?itemName=colbyrussell.vscode-ober... Paul, I'm glad you found it useful. To be honest, I didn't set out to create an extension. I uploaded it a while back after noticing that there weren't any others available, and I got tired of seeing things rendered as plain text. (Otherwise, I ordinarily just use Vim and enable its built-in support for Modula-2 when browsing Oberon source files.) The extension is little more than the grammar that vladfolts distributes with oberonjs: <https://github.com/vladfolts/oberonjs> ... plus a bunch of metadata that VSCode requires to satisfy the extension packaging format. I did make a few changes based on some spot-checking of how things looked after activating the extension and skimming the Project Oberon 2013 system source. As the description for Vlad's repo suggests, the grammar is only meant to cover Oberon-07. The extension itself doesn't specify any colors, just the grammar I mentioned; whatever colors you're seeing come from your active VSCode theme.
But I have no idea how to recover the syntax from the .vsix file.
As Jörg hinted, the VSCode package format is a zip file with a .vsix extension. Alternatively, you can type "ext" in VSCode's command palette and choose the "Open Extensions Folder" item to browse the unzipped files already on your disk. -- Colby Russell
Hi Colby,
https://marketplace.visualstudio.com/items?itemName=colbyrussell.vscode-o beron-support
...(Otherwise, I ordinarily just use Vim and enable its built-in support for Modula-2 when browsing Oberon source files.)
Right, so existing Modula-2 support in VS Code would probably have sufficed for you and me both. This relates to Bernhard's efforts with GitHub which seemingly were exacerbated by the pre-existing Modula-2 class, so I suggested just calling it Modula-2/Oberon. I see he's passed that on too, thanks Bernhard!
The extension is little more than the grammar that vladfolts distributes with oberonjs... plus a bunch of metadata that VSCode requires to satisfy the extension packaging format...The extension itself doesn't specify any
colors, just the grammar I > mentioned; whatever colors you're seeing come from your active VSCode > theme.
Actually what I didn't like about the colours was that IF, THEN, and ELSE are in one colour and END (as well as PROCEDURE and BEGIN) was in another colour.
But I have no idea how to recover the syntax from the .vsix file.
As Jörg hinted, the VSCode package format is a zip file with a .vsix extension. Alternatively, you can type "ext" in VSCode's command palette and choose the "Open Extensions Folder" item to browse the unzipped files already on your disk.
Right but what I really meant was "I have no idea what to do with the .vsix file", and you've helped clarify things considerably; so above all, thank you! Cheers, Paul
On 2018-08-02 21:22, Colby Russell wrote:
https://marketplace.visualstudio.com/items?itemName=colbyrussell.vscode-ober... ...uploaded it a while back after noticing that there weren't any others available
With many thanks to Colby and vladfolts, and other valiant illuminators of the concepts involved, below is a JSON version of their Oberon-07 textmate/vs grammar, updated to fix a couple of things including nested comments. In case it's useful. Works for me; YMMV. Cheers, Paul {"scopeName": "source.oberon", "fileTypes": ["Mod"], "patterns": [ {"match": "\\b(FOR|REPEAT|IF|ELSIF|UNTIL|WHILE|DO|ELSE|THEN|CASE|BY|RETURN|TO|IMPORT|BEGIN|TYPE|CONST|MODULE|VAR|PROCEDURE|END)\\b", "name": "keyword.delimiter.oberon"}, {"match": "\\b(IS|DIV|MOD|OR|IN)\\b", "name": "keyword.operator.oberon"}, {"match": "\\b(POINTER|RECORD|ARRAY|MAP|OF)\\b", "name": "storage.type.oberon"}, {"match": "\\b(FALSE|NIL|TRUE)\\b", "name": "constant.language.oberon"}, {"match": "\\b(ABS|ASR|CHR|FLT|INC|LSL|NEW|ROR|ASSERT|DEC|EXCL|FLOOR|INCL|LEN|ODD|ORD|PACK|UNPK)\\b", "name": "support.function.oberon"}, {"match": "\\b(CHAR|REAL|BYTE|INTEGER|LONGINT|SET|BOOLEAN)\\b", "name": "support.type.oberon"}, {"match": "\\b(([0-9][0-9A-F]*[H])|([0-9]+[.][0-9]*([ED][+-]?[0-9]+)?)|([0-9]+))\\b", "name": "constant.numeric.oberon"}, {"begin": "\"", "end": "\"", "name": "string.quoted.double.oberon"}, {"match": "\\b([0-9][0-9A-F]*X)\\b", "name": "string.quoted.other.oberon"}, {"include": "#comment"} ], "repository": {"comment": {"begin": "\\(\\*", "end": "\\*\\)", "patterns": [{"include":"#comment"}], "name": "comment.block.oberon", "captures": {"0":{"name":"punctuation.definition.comment.oberon"}}}}, "name": "Oberon", "uuid": "2AA78D88-FD4B-11E6-937E-CFB8A4F7030F"}
On 8/11/20 9:38 AM, Paul Reed wrote:
With many thanks to Colby and vladfolts, and other valiant illuminators of the concepts involved, below is a JSON version of their Oberon-07 textmate/vs grammar
NB: Any credit goes to vladfolts (as far as I know) for the grammar definition, and none to me. About a week and a half ago, I got an email from a VSCode user asking about fixing bugs, et cetera. Here was my response with an open offer that applies here, too: "If you're referring to a repo and an open development model, there isn't one. This extension never was a serious undertaking; I only created it because at the time VSCode's lack of syntax highlighting for Oberon bothered me. As I wrote in that thread, the heart of the extension is a copy of the TextMate/Sublime Text grammar from vladfolts's project. In fact, that's pretty much all it is--the rest is a bunch of VSCode boilerplate. "If you or anyone you know wants to take over this extension (or start your own with the same name and have me de-list this one from the VSCode gallery), then let me know." (In fact, I don't even use the extension today, because since the last time I got a computer, I haven't needed to install it or otherwise even work with any Oberon source files in VSCode.) -- Colby Russell
"If you or anyone you know wants to take over this extension (or start your own with the same name and have me de-list this one from the VSCode gallery), then let me know."
Thanks for getting in touch with your thoughts on this. Feel free to email me directly, and/or feel free to take my code to update your syntax file (or both!). :) Cheers, Paul
Hello Colby, Am 11.08.2020 um 17:11 schrieb Colby Russell:
"If you or anyone you know wants to take over this extension (or start your own with the same name and have me de-list this one from the VSCode gallery), then let me know."
I've built my own Oberon extension based on yours, and added "*.Mod.txt" as glob pattern, as well as updated the grammar file and language definition (automatic indentation after certain keywords, for example). I also added support for (optionally) calling out to an LSP Server for semantic highlighting, folding, definition/references and compile error reporting. I also wrote an LSP server in Java which embeds an Oberon RISC Emulator and runs a slightly patched version of ORP in it (either the original version, Andreas' Extended Oberon or Andreas' Oberon Retro Compiler). The LSP server can either run in a cached mode where it scans the workspace folders and caches the compilation results, or in a non-cached mode where it only tracks open files but recompiles them on-the-fly (which means that finding references is faily limited, but jumping to definitions works well). The non-cached mode has also been tested with Eclipse as LSP client. If you look at the source, you will see various mentions of A2; however, my current A2 Language Server is still in its infancies and not ready to be published yet (and no promises that it will happen). All of this is available at <https://github.com/schierlm/OberonEmulator/releases/tag/lspserver-0.1> The patches to the Oberon compiler are available at <https://github.com/schierlm/Oberon2013Modifications/tree/master/LanguageServerProtocolHelper> I did not bother publishing the .vsix to the Marketplace, but if people would prefer having it there and your version delisted, I can certainly try publishing it there, too. Regards, Michael
participants (6)
-
Chris Burrows -
Colby Russell -
Jörg -
Michael Schierl -
Paul Reed -
Treutwein Bernhard