GithubHelp home page GithubHelp logo

Comments (8)

cpitclaudel avatar cpitclaudel commented on August 26, 2024

Hey Nik,

It probably means that there's a bug somewhere :) Can you post the corresponding source? I'll have a look.

from fstar-mode.el.

nikswamy avatar nikswamy commented on August 26, 2024

https://github.com/mitls/mitls-fstar/blob/master/src/tls/ConnInvariant.fst

I'm using GNU Emacs 24.5.1 (i686-pc-mingw32)

Thanks!

from fstar-mode.el.

cpitclaudel avatar cpitclaudel commented on August 26, 2024

Thanks Nik. This seems to be due to the heuristic for guessing whether something is a variable or a function; it highlights things as functions if it sees anything looking like an argument before seeing an equal sign after a let-binding. Since syntax highlighting works on a per-line basis in Emacs, it gets confused about the last two definitions, and accidentally highlights the first of the two differently because of the final space.

The indentation code is actually pretty complex, due to having to to look ahead arbitrarily far. I wonder if it wouldn't be better to simplify it and always highlight things after a let the same.

Do we have a quick-reference cheatsheet for F* that we could highlight manually? It would serve as a nice test suite for highlighting code.

from fstar-mode.el.

cpitclaudel avatar cpitclaudel commented on August 26, 2024

Apparently tuareg mode uses a simple heuristic, in which the name after let is always colored as a function, unless it is immediately followed by an = sign. It breaks with let a \n = 1, but this sounds acceptable.

I'll try implementing that for F* too.

from fstar-mode.el.

cpitclaudel avatar cpitclaudel commented on August 26, 2024

Also, looking at the highlighting again, I think I was a bit too enthusiastic about highlighting arguments in lets. Maybe I should revisit that too.

from fstar-mode.el.

nikswamy avatar nikswamy commented on August 26, 2024

I think distinguishing function from non-functions is overrated, particularly as only the definition site is (maybe) colored, not the uses also.

Can we color all identifiers uniformly? I wouldn't mind if the definitions were in the orange-ish shade used now and the uses were black.

from fstar-mode.el.

cpitclaudel avatar cpitclaudel commented on August 26, 2024

Sure, that sounds good!

from fstar-mode.el.

cpitclaudel avatar cpitclaudel commented on August 26, 2024

Ok, done I think :) The updated package should be on MELPA in a few hours.

I tried to simplify the highlighting and make it more robust. F*'s syntax is not the easiest to parse with regular expressions :)

I'd be interested in experimenting with a way to make highlighting better, through e.g. an external process that actually understands F*'s syntax.

from fstar-mode.el.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.