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

Add Solidity (lexer and examples) #760

Merged
merged 31 commits into from
Apr 5, 2020

Commits on Mar 26, 2020

  1. spec/lexers/sampes/demos: add Solidity lexer (squashed branch).

    Squashed commits:
    
    spec/lexers: Solidity spec, based on tutorial's Turtle spec.
    
    samples: add Solidity sample (from pygments-lexer-solidity).
    
    See https://gitlab.com/veox/pygments-lexer-solidity.
    
    File permalink:
    
    https://gitlab.com/veox/pygments-lexer-solidity/blob/8e9919b5e9e91a2022def2a4c51003bc99042686/example.sol
    
    The Pygments lexer's example was written by me, and is licensed
    under a BSD license.
    
    demos: minimal Solidity demo.
    
    lexers: track solidity.rb (verbatim copy of c.rb).
    
    lexers/solidity: proper class, extensions, other meta stuff.
    
    lexers/solidity: added some keywords (not all!).
    
    lexers/solidity: remove float, added types TODO.
    
    lexers/solidity: constants, strings.
    
    lexers/solidity: clean-up + remove function state.
    
    lexers/solidity: complex MxN types.
    
    lexers: fix mimetype (`text/solidity` -> `text/x-solidity`).
    
    spec: comment guess-by-source section that makes tests fail.
    
    Test fails because something (?) is guessed as PlainText.
    
    lexers/solidity: add missing `assert` and `require` keywords (+ demos/solidity: rewrite).
    
    A few more keywords may well be missing. Used
    
    https://github.com/ethereum/solidity/blob/0a04a35a2e02437ae038af41c947b3e829946bca/libsolidity/parsing/Token.h
    
    to check - probably should look for "preprocessor" directives, or
    built-ins, or the like, - in Solidity's source tree.
    
    demos/solidity: fix to compile.
    
    lexers/solidity: populate builtins + remove a few more C lexer leftovers.
    
    SQ
    veox committed Mar 26, 2020
    Configuration menu
    Copy the full SHA
    afd8be9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    672ee0a View commit details
    Browse the repository at this point in the history
  3. lexers/solidity: add new keywords mentioned in feedback.

    This is done before "porting" in changes from Pygments' lexer,
    so it's out of the way.
    veox committed Mar 26, 2020
    Configuration menu
    Copy the full SHA
    d5f6378 View commit details
    Browse the repository at this point in the history
  4. lexers/solidity: add changes up to (mostly) Solidity v0.4.22.

    These are "ported" from Pygments' lexer. I'm not 100% on the
    terminology.
    veox committed Mar 26, 2020
    Configuration menu
    Copy the full SHA
    e1b6522 View commit details
    Browse the repository at this point in the history
  5. lexers/solidity: add new keywords from Solidity v0.6.0.

    Natspec, Assembly, Yul, and some built-in functions are still
    unimplemented.
    veox committed Mar 26, 2020
    Configuration menu
    Copy the full SHA
    e65c995 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    612c65b View commit details
    Browse the repository at this point in the history
  7. lexers/solidity: mark regexes in rules explicitly.

    This calms down Rake warnings about ambivalence.
    veox committed Mar 26, 2020
    Configuration menu
    Copy the full SHA
    dbec54a View commit details
    Browse the repository at this point in the history
  8. spec/solidity: uncomment and fix "test by source".

    The issue was that the line is not technically a shebang.
    
    So, use a `starts_with?` instead.
    veox committed Mar 26, 2020
    Configuration menu
    Copy the full SHA
    c219854 View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2020

  1. Configuration menu
    Copy the full SHA
    a8ee009 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7692571 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9ca9556 View commit details
    Browse the repository at this point in the history
  4. Fix 'uintb' typo

    pyrmont committed Mar 31, 2020
    Configuration menu
    Copy the full SHA
    aded449 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4ba1cf7 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    f416146 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    2a14012 View commit details
    Browse the repository at this point in the history
  8. lexers/solidity: update [u]fixed{M}x{N} types to "new" scheme.

    Don't remember when it changed, but sample file already had the
    "new" scheme used + comments to support it, so I guess Solidity
    v0.5.0 or so.
    veox committed Mar 31, 2020
    Configuration menu
    Copy the full SHA
    a828d47 View commit details
    Browse the repository at this point in the history

Commits on Apr 1, 2020

  1. Configuration menu
    Copy the full SHA
    8b09d51 View commit details
    Browse the repository at this point in the history

Commits on Apr 2, 2020

  1. lexers/solidity: user regex to match [u]fixed{M}x{N} instead.

    As requested by @pyrmont, for performance's sake:
    
    rouge-ruby#760 (comment)
    veox committed Apr 2, 2020
    Configuration menu
    Copy the full SHA
    5f81d9b View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2020

  1. Configuration menu
    Copy the full SHA
    6f793ba View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2242a4d View commit details
    Browse the repository at this point in the history
  3. lexers/solidity: remove duplicate rule for (block|msg|tx).{stuff}.

    They are already covered in `def self.builtins`.
    veox committed Apr 3, 2020
    Configuration menu
    Copy the full SHA
    d7ccc70 View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2020

  1. Configuration menu
    Copy the full SHA
    f19341e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8b42435 View commit details
    Browse the repository at this point in the history

Commits on Apr 5, 2020

  1. Add nested comments

    pyrmont committed Apr 5, 2020
    Configuration menu
    Copy the full SHA
    6d46215 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c8d3f3f View commit details
    Browse the repository at this point in the history
  3. Simplify demo

    pyrmont committed Apr 5, 2020
    Configuration menu
    Copy the full SHA
    2e824fa View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b56f33c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    479a6d2 View commit details
    Browse the repository at this point in the history
  6. samples/solidity: make example of comment-to-EOF more wordy.

    Outline also why there should be no multi-level comments, demonstrate
    it, and allow for reasonably bloodless manual testing by removing
    spaces.
    veox committed Apr 5, 2020
    Configuration menu
    Copy the full SHA
    8b471bb View commit details
    Browse the repository at this point in the history
  7. lexers/solidity: add missing abi.decode.

    Thanks @axic!
    
    Co-Authored-By: Alex Beregszaszi <alex@rtfs.hu>
    veox and axic committed Apr 5, 2020
    Configuration menu
    Copy the full SHA
    103718e View commit details
    Browse the repository at this point in the history
  8. samples/solidity: split no-multiline-nesting and multiline-to-eof cases.

    Two visual demo cases got conflated: the initial one of multiline
    comments being open until the end of file, and the new one of no
    such thing as nested multiline comment blocks.
    
    This commits separates them.
    veox committed Apr 5, 2020
    Configuration menu
    Copy the full SHA
    1555984 View commit details
    Browse the repository at this point in the history