Menu

#1063 Rust Lexer updates

Committed
closed
5
2014-08-14
2014-07-29
SiegeLord
No

These patches update the Rust lexer to the newest Rust features:

  • Naked CR can now be escaped in strings.
  • If the file starts with these 3 characters: #![ then that does not count as a hashbang comment.
  • Added byte-string literals (b'x', b"x" and br"x"), which are similar to existing string literals but with some restrictions on their contents.

The SciTE patch adds the styles for the byte-string literals and updates the keyword list.

2 Attachments

Discussion

  • Neil Hodgson

    Neil Hodgson - 2014-07-30

    Committed first 3 as [8b0ea8], [14e632], and [3b6ac6].

    Bumping the copyright year isn't really needed and I no longer do it. Having the year of origin is useful. As an individual, copyright lasts for 50 or more years after your death depending on jurisdiction. Its not based on the date of the last change. If you really want to update the year that is fine but, to me, its just commit noise.

    An issue with the Rust lexer came up recently because of a shadowed variable warning in [feature-requests:#1059]. There are 2 variables called old_pos in ScanNumber and their lifetimes do not make sense.

     

    Related

    Feature Requests: #1059
    Commit: [14e632]
    Commit: [3b6ac6]
    Commit: [8b0ea8]

  • SiegeLord

    SiegeLord - 2014-07-30

    Thanks, and understood about the copyright year.

    I'll send you a patch for the warning asap.

     
  • SiegeLord

    SiegeLord - 2014-08-02

    Ok, here's the patch to fix that shadowing issue. I notice that it's quite tricky to detect these variable shadowings, as even adding a -Wshadow did not make GCC (4.8.1) and Clang (3.3) report any warnings for that variable.

    Also, while reviewing the code I've noticed that I've neglected to comment it as much as I should have, perhaps unduly reducing the maintainability of this. Would you accept patches adding some comments here and there?

     
    • Colomban Wendling

      That's because of [f8ff456eeb5878cbdd2c557eca76d6090696d2d2] I guess, because on 3.4.4 it showed just fine, either with GCC 3.8 or 3.9 at least.

       

      Related

      Commit: [f8ff45]

  • Neil Hodgson

    Neil Hodgson - 2014-08-02

    Committed as [85a5b4].

    Whatever level of comments you are happy with is fine. To me, a reference to the language syntax definition being used would be more helpful.

     

    Related

    Commit: [85a5b4]

  • Neil Hodgson

    Neil Hodgson - 2014-08-05
    • labels: --> scintilla, lexer, rust
    • assigned_to: Neil Hodgson
    • Group: Completed --> Committed
     
  • Neil Hodgson

    Neil Hodgson - 2014-08-14
    • status: open --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.