Domanda

Is it possible to:

  1. throw custom parser errors using uu-parsinglib in Haskell? (I want especially to print custom error message with position information)
  2. customize the way errors are displayed to the user?
  3. somehow control where the automatic correction take place, where not? I want for example to deny some autocorrection steps, like deleting the first letter of identifier if it is upper case (identifiers should start with lowercase)
È stato utile?

Soluzione

1) The error messages are either "Inserted String position [String]" in case something was inserted and "Deleted String position" in case something was deleted. You can easily define your own version of the standard show function in your version of "run". We call there just show, but wrapping the messages will enable you to redefine show.

2) see 1

3) You can play with insertion and deletion costs. In general try only to increase them. A costs of over a 1000 skips that alternative completely. The standard deletion costs is 4. I do not understand what you want to do with that capital letter at the beginning of a lower case identifier. Accept it anyway? If you want to increase deletion costs you may want to write your own version of pSym etc.

Doaitse Swierstra

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top