Menu

#1321 [Scintilla][SciTE] Add support for the V Programming Language

Completed
open
nobody
5
2019-11-05
2019-10-30
Lenain
No

Hello,

This lexer adds support for the V Programming Language ( https://vlang.io/ ) in Scintilla.
A properties file for SciTE is also provided.

Kind regards,

1 Attachments

Discussion

  • Neil Hodgson

    Neil Hodgson - 2019-10-30

    This code lexes poorly:

    println('open file "$path"')
    // Looks like string
    

    The extension 'v' is already assigned to Verilog in SciTE which makes it difficult to include V seamlessly. The V mode will have to be disabled by default and enabled by editing a properties file.

    A warning is issued for an unused parameter which can be avoided by not naming the parameter.

    ..\lexers\LexV.cxx(238): warning C4100: 'keywordlists': unreferenced formal parameter
    
     
  • Jad Altahan

    Jad Altahan - 2019-10-31

    I was actually thinking about V support in Scintilla a week ago. I looked at some V code from their repository and it seems that it is heavily influenced by Go.

    V and Go are both are both brace-based languages. Wouldn't it be more viable to extend the CPP lexer to meet the requirements of these language rather than write a new one?

     
    • Neil Hodgson

      Neil Hodgson - 2019-10-31

      From a maintenance point-of-view it can be simpler for languages to be isolated so changes to one language don't disturb others.

      The CPP lexer is overly complicated by the preprocessor and most of the bracey languages don't use a preprocessor or have a very tame one.

      If there is strong commonality, it may be worth writing a brace language lexer that omits the CPP preprocessor code. However, brace languages are becoming more divergent. The major areas of divergence are

      1. Comment delimiters
      2. String quoting
      3. String escapes
      4. String interpolation

      String interpolation can be quite messy and its becoming increasingly common and complex as expressions are included. Like this Swift code

      print("Crew: \(names.formatted(empty: "No one")).")
      
       
  • Lenain

    Lenain - 2019-11-03

    Thanks,
    I believe I made the Lexer more robust about literals/strings/raw strings handling and fixed the warning.
    Kind regards,

     
    • Neil Hodgson

      Neil Hodgson - 2019-11-05

      From Visual C++:

      ..\lexers\LexV.cxx(38): warning C4100: 'previousStringStyle': unreferenced formal parameter
      

      The stringInterpolationParenthesisLevel and previousStringStyle variables do not appear to reset at line end when the string state is dropped which could lead to problems with unbalanced interpolations. These may be invalid but temporarily invalid code occurs while editing.

       

Log in to post a comment.

MongoDB Logo MongoDB