azdavis / millet

A language server for Standard ML.
https://azdavis.net/posts/millet
Apache License 2.0
196 stars 12 forks source link

`couldn't process CM file: expected a class` #4

Closed jez closed 2 years ago

jez commented 2 years ago

Environment

Steps to reproduce

git clone https://github.com/jez/multi-grep
cd multi-grep
mv multi-grep.cm sources.cm # see issue #3
~/github/millet/target/debgug/cli

Expected behavior

no error

Actual behavior

❯ ~/github/millet/target/debug/cli
Error: /Users/jez/Dropbox/Documents/Programming/cli/multi-grep/sources.cm: couldn't process CM file: expected a class

Caused by:
    expected a class

It would be nice to at least know which line number of the CM file failed to parse, so I could know what the problem is. The contents of the CM file in question:

Group is
  $/regexp-lib.cm
  vendor/cmlib/cmlib.cm

  src/prelude.sml : succ-ml
  src/util.sml : succ-ml

  src/options.sml : succ-ml

  src/main.sig
  src/main.sml : succ-ml
azdavis commented 2 years ago

yeah, i put more effort into having good error locations etc for sml errors, while the cm error reporting is far more rudimentary.

in this case i’m thinking the error is because the class (the thing after the :) isn’t understood by millet. specifically “succ-ml”. millet only knows about a few classes, and actually allows processing even fewer (cm and sml only).

azdavis commented 2 years ago

i think instead of having an exhaustive list of classes (i think it’s possible to define arbitrary cm classes with user code?) i could just keep it a string and then only accept some, like “sml”, “cm”, and “cmfile”. that would improve the error here

azdavis commented 2 years ago

i think there are actually two separate issues here: