Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing support for Modula-2 dialect tags #1

Open
trijezdci opened this issue Jun 12, 2019 · 1 comment
Open

Missing support for Modula-2 dialect tags #1

trijezdci opened this issue Jun 12, 2019 · 1 comment

Comments

@trijezdci
Copy link

trijezdci commented Jun 12, 2019

There is a quasi-standard for dialect tags agreed among several compiler maintainers. Any newly developed syntax highlighting should aim to support this.

For example, the pygments syntax rendering framework for Python, Gaius Mulley's Emacs highlighting for Modula-2 and Benjamin Kowarsch's highlighting for vim support the tags.

A dialect tag is a special comment that indicates in which dialect the code has been written.

dialectTag :=
  "(*!" dialectMnemonic ( "+" compilerMnemonic )? "*)"
  ;

A dialect mnemonic indicates the dialect

dialectMnemonic :=
    "m2pim" /* for PIM */
  | "m2iso" /* for ISO */
  | "m2r10" /* for R10 */ 
  | ...
  ;

An optional compiler mnemonic indicates language extensions of a specific compiler.

compilerMnemonic :=
  "ack" | "gm2" | "mocka" | "p1" | ...
  ;

No whitespace is permitted.

At the very least the dialect mnemonics for PIM, ISO and R10 should be supported.

A dialect tag is placed ideally before or directly after the module header in a Modula-2 source file. The highlighting script should scan for the first occurrence of such a tag within the first 100-200 lines of source (accounting for a copyright header that may occur at the top).

If a tag is found, the highlighting script should render the source code according to the dialect indicated by the dialect tag. Otherwise it may use a default setting. A more sophisticated script could search for a keyword that is unique in only one dialect, but this is not really necessary since people who want their source files to be rendered properly will soon learn to add dialect tags to all their sources.

For more details, see the Modula-2 documentation for pygments at:

https://www.pydoc.io/pypi/Pygments-2.1.3/autoapi/modula2/index.html

and the Modula-2 support package for Vim at:

https://bitbucket.org/trijezdci/m2syntaxcolour/src/default/Vim/

@Lucretia
Copy link

This extension does highlighting by regular expressions, as most vscode syntax highlighting does. This would need to be changed to a programmed syntax highlighter for this to work.

Is this tag normally inside a comment? Those links don't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants