1. Georg Brandl
  2. pygments-main
  3. Pull requests

Pull requests

#626 Open
Repository
veox
Branch
add-solidity
Repository
birkenfeld
Branch
default

Add Solidity lexer

Bitbucket cannot automatically merge this request.

The commits that make up this pull request have been removed.

Bitbucket cannot automatically merge this request due to conflicts.

Review the conflicts on the Overview tab. You can then either decline the request or merge it manually on your local system using the following commands:

hg update default
hg pull -r add-solidity https://bitbucket.org/veox/pygments-main
hg merge add-solidity
hg commit -m 'Merged in veox/pygments-main/add-solidity (pull request #626)'
Author
  1. Noel Maersk
Reviewers
Description

This is not based on the Solidity GitHub repo, but instead on JavaScript, C/C++, and Go lexers from the pygments-main repo. As such, it is not burdened by the possible legal/licensing issues (as in PR #609).

Compared to that, this fixes most of the issues highlighted by David Corbett - exception is string escaping, since I can't figure that out easily (EDIT: now addressed).

example.sol is now also included.

The history-as-it-was is in my default branch - I've not used mercurial much, sorry.

Comments (18)

    1. Noel Maersk author

      I've basically copied the string state from there. This also seems to be the only place where the compiler doesn't complain on encountering a continuation character, so I left it be.

  1. Noel Maersk author

    I think I fixed most of what you noted to the best of my ability.

    Honestly, I'd prefer this being committed even if it's imperfect. I believe that eventually people more knowledgeable than I can fix my blunders. But that would require them seeing their code being highlighted wrong first. :)

  2. Noel Maersk author

    Fixed string parsing as recommended by David Corbett.

    To parse both double- and single-quote string literals, I split string-parse into string-parse-{common,double,single}, and used combined() in strings state.

  3. Noel Maersk author

    Added example.sol - wrote it myself, too, to avoid any possible licensing issues if "importing" from elsewhere.

    Here's a pygmentized copy using the emacs style. Latest version pushed there is actually from my default branch, so could be ahead of what's in this PR. I guess it has so many commits now, I'll have to open a new PR with another branch anyway (to reduce noise in the tree).

    I've done a sed -i 's/BB6622/0066FF/;s/\.o { color: #666666/.o { color: #FF0000/' /tmp/example.html to highlight string escapes and operators.

  4. Shayan Es

    Noel Maersk Hey there, this doesn't seem to be merged anytime soon. I'm trying to use this syntax highlighter now, added these files to the appropriate directories but doesn't seem to have any effects. Do you know what i'm missing there or how I can get it to work?