Code Monkey home page Code Monkey logo

m2-syntax-colour's Introduction

M2-Syntax-Colour

Syntax Descriptions for Colouring/Highlighting Modula-2

Supported Modula-2 Dialects

  • Classic Modula-2 (aka PIM)
  • ISO Modula-2 (ISO 10514)
  • Modula-2 R10

Supported Frameworks

  • GeSHi (PIM only)
  • Highlight (PIM only)
  • LaTeX Listings package
  • Pygments

Supported Editors/IDEs

  • BBEdit/TextWrangler
  • Kate (Part of KDE)
  • Vim/vi

m2-syntax-colour's People

Contributors

trijezdci avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dkearns

m2-syntax-colour's Issues

Vim: gm2 syntax extensions

Benjamin,

If I was to start cobbling together a gm2 extensions syntax file would you be interested in hosting it here or would you prefer it just be included directly in Vim? I'd be happy to maintain it.

Thanks,
Doug

Vim: multiline :syn-match patterns

G'day Benjamin,

I just noticed the following comment in one of the Vim syntax files.

"| *** VMSCRIPT BUG ALERT ***
"| The regular expression below causes errors when split into separate strings
"|
"| syn match m2Base10Num
"| \ "\(\(0[bux]\@!\|[1-9]\)[0-9]*\('[0-9]\+\)*\)" .
"| \ "\(\.[0-9]\+\('[0-9]\+\)*\(e[+-]\?[0-9]\+\('[0-9]\+\)*\)\?\)\?"
"|
"| E475: Invalid argument: m2Base10Num "\(\(0[bux]\@!\|[1-9]\)[0-9]*\('[0-9]\+\)*\)"
"| . "\(\.[0-9]\+\('[0-9]\+\)*\(e[+-]\?[0-9]\+\('[0-9]\+\)*\)\?\)\?"
"|
"| However, the same regular expression works just fine as a sole string.
"|
"| As a consequence, we have no choice but to put it all into a single line
"| which greatly diminishes readability and thereby increases the opportunity
"| for error during maintenance. Ideally, regular expressions should be split
"| into small human readable pieces with interleaved comments that explain
"| precisely what each piece is doing. Vimscript imposes poor design. :-(
syn match m2Base10Num
\ "\(\(0[bux]\@!\|[1-9]\)[0-9]*\('[0-9]\+\)*\)\(\.[0-9]\+\('[0-9]\+\)*\(e[+-]\?[0-9]\+\('[0-9]\+\)*\)\?\)\?"

The m2Base10Num pattern is not a string literal. The quotes in this case are just pattern delimiters, any character can be used. So, if you wish, it can be split over multiple lines using a normal line continuation and insert comments with a leading "\ sequence (trailing space required - see :help line-continuation-comment).

syn match m2Base10Num
  \ /\(\(0[bux]\@!\|[1-9]\)[0-9]*\('[0-9]\+\)*\)
  "\ a comment
  \\(\.[0-9]\+\('[0-9]\+\)*\(e[+-]\?[0-9]\+\('[0-9]\+\)*\)\?\)\?/

Alternatively you could use something like the following to interleave comments as described.

" a comment for part 1
let part1 = '\(\(0[bux]\@!\|[1-9]\)[0-9]*\(''[0-9]\+\)*\)'
" a comment for part 2
let part2 = '\(\.[0-9]\+\(''[0-9]\+\)*\(e[+-]\?[0-9]\+\(''[0-9]\+\)*\)\?\)\?'

exe $"syn match m2Base10Num2 /{part1}{part2}/"

Obviously, neither of these are as nice as Perl's x modifier but maybe they're of some use to you.

Regards,
Doug

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.