#1459 Improvements to Haskell Lexer

Bug
closed-fixed
3
2013-07-21
2013-04-03
kudah
No
  • Added support for MagicHash extension (lexer.haskell.allow.hash)
  • $ and # are now colored as operators.
  • .0 and -0 are now properly colored as operator and a number, not as just number.
  • Operators starting with double dash (e.g ---->) are properly colored as operators, not comments.
  • Added pragma highlighting.
  • Added basic C-preprocessor highlighting.
  • Qualified names (e.g. ABC.xyz) are now properly highlighted as identifiers, not types.
  • Qualified operators (e.g. ABC.<$>) are now properly highlighted as operators.
  • Operator . is now properly highlighted as an operator, not part of the identifier, when applied to a qualified and an unqualified value (e.g. Abc.xyz.yzx <- last one is an operator)
  • Operators starting with ':' are now properly highlighted as type constructors, not operators.
  • "family" after "data" is highlighted, as per TypeFamilies.
1 Attachments

Discussion

1 2 3 4 > >> (Page 1 of 4)
  • Neil Hodgson

    Neil Hodgson - 2013-04-04

    There's a comment convention (starting with "// property ") for new lexer-specific properties which allows containers to automatically set up documentation/UI. See LexPython.cxx for examples.

    There is some strange stuff near the top of the .patch (the block that includes ++++++++++++++++++++++--------------) which ends up in the commit message.

    Is "kudah" the correct name for credits lists? Unicode is fine for names.

     
    • kudah

      kudah - 2013-04-04

      There's a comment convention (starting with "// property ") for new lexer-specific properties which allows containers to automatically set up documentation/UI. See LexPython.cxx for examples.

      Okay, added a property comment in attachment.

      There is some strange stuff near the top of the .patch (the block that includes ++++++++++++++++++++++--------------) which ends up in the commit message.

      It's git commit summary.

      Is "kudah" the correct name for credits lists? Unicode is fine for names.

      It's a nickname. If a real name is obligatory, I'd rather just hand over copyright.

       
      Last edit: kudah 2013-04-04
  • kudah

    kudah - 2013-04-04

    Reformatted as a single patch.

     
    Last edit: kudah 2013-04-04
  • Neil Hodgson

    Neil Hodgson - 2013-04-05

    Committed as [0b7306].

     

    Related

    Commit: [0b7306]

  • kudah

    kudah - 2013-04-05

    Thanks!

     
  • kudah

    kudah - 2013-04-07

    Fixed few things in haskell lexer

    • MagicHash now applies to literals.
    • MagicHash is now only allowed at the end of identifier.
    • SafeHaskell imports are now highlighted (lexer.haskell.import.safe)
    • TemplateHaskell quoted names are now highlighted
    • Constructors promoted to types are now highlighted
    • Promoted tuples, lists, and operator constructors are now highlighted.
    • Qualified constructors are now properly highlighted as constructors, not operators.
    • Capital and qualified names in import lists are now properly highlighted.
    • A.$b is not properly highlighted as an operator and an identifier, not just operator.
    • String and preprocessor continuations now work with CRLF.
     
  • Neil Hodgson

    Neil Hodgson - 2013-04-08

    g++ produces a warning:
    ../lexers/LexHaskell.cxx: In function 'void skipMagicHash(StyleContext&, bool, bool)':
    ../lexers/LexHaskell.cxx:90:7: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]

     
  • kudah

    kudah - 2013-04-09

    Oops, my previous patch broke string escaping, fixed. Also fixed nested comments, which were a bit broken since the beginning, and completely broken since my first patch. Copied over python's Folder with adjustments; it's moderately useful as is, even though it doesn't yet handle NondecreasingIndentation, explicit braces, Haddock comments and group definitions.

     
  • Neil Hodgson

    Neil Hodgson - 2013-04-12

    There's one line that appears to have no effect, 506, with the result not used after it is set:

    // Set up initial loop state
    startPos = styler.LineStart(lineCurrent);

     
  • kudah

    kudah - 2013-04-12
    • Converted Haskell lexer to a class
    • Removed external lexer
    • Haskell lexer now folds imports
     
  • Neil Hodgson

    Neil Hodgson - 2013-04-13

    There's a dead assignment to importCurrent inside the folding loop.

     
    • kudah

      kudah - 2013-04-13

      Yeah.

       
      Last edit: kudah 2013-04-13
  • kudah

    kudah - 2013-04-17

    Oops, I thought you meant the other dead assignment.

     
  • Neil Hodgson

    Neil Hodgson - 2013-04-17

    The folder only recognizes "import" at line start although the doc doesn't say that. Its fine if you only want to recognize at line start although an arbitrary example program I downloaded had indented imports.

     
  • kudah

    kudah - 2013-04-18

    an arbitrary example program I downloaded had indented imports.

    Never seen an import being indented in real code. Imports obey module's layout rule, so the only way to indent an import further without also indenting everything in the module is to use explicit layout(e.g. put a semicolon at the end of previous declaration). You can't indent first import without affecting module's layout.

     
    • Neil Hodgson

      Neil Hodgson - 2013-04-18

      This is the example I used: http://www.angelfire.com/tx4/cus/shapes/haskell98.html

      There's a warning from Clang:
      ../lexers/LexHaskell.cxx:175:17: warning: Value stored to 'ch' during its initialization is never read
      int ch = styler.SafeGetCharAt(currentPos);
      ^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

       
      • kudah

        kudah - 2013-04-18
         
        Last edit: kudah 2013-04-18
  • kudah

    kudah - 2013-04-19
    • Comment block's style now circles between SCE_HA_COMMENTBLOCK and SCE_HA_COMMENTBLOCK3 depending on nesting. (Haskell seems to be the only language for which scintilla defines more than one COMMENTBLOCK style, why's that? INSTANCE/CLASS/DATA/IMPORT are useless too. (instances are anonymous, nothing to style, classes are types(CAPITAL), data&import are KEYWORDs)
    • Lowercase identifiers beginning with '?' are now colored as per ImplicitParams extension.(lexer.haskell.allow.questionmark)
    • Added STRINGEOL style.
     
    • Neil Hodgson

      Neil Hodgson - 2013-04-20

      Committed as [3176ee].

       

      Related

      Commit: [3176ee]

  • kudah

    kudah - 2013-04-19

    Unicode support for Haskell lexer. I haven't noticed any functions to classify unicode chars in scintilla, so I simply copied general categories from GHC. Sorry if I missed anything.

     
    • kudah

      kudah - 2013-04-19
       
      Last edit: kudah 2013-04-19
      Attachments
    • Neil Hodgson

      Neil Hodgson - 2013-04-19

      I'd prefer not to distribute large Unicode tables.

       
1 2 3 4 > >> (Page 1 of 4)

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks