An Erlang lexer and syntax highlighter in Gleam
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add the `stringify_error` function

+25
+25
src/pearl.gleam
··· 46 46 ) 47 47 } 48 48 49 + pub fn stringify_error(error: Error) -> String { 50 + case error { 51 + ErrorUnterminatedAtom -> "Unterminated atom" 52 + ErrorUnterminatedString -> "Unterminated string literal" 53 + ExpectedExponent -> "Expected an exponent" 54 + ExpectedSigilDelimiter -> "Expected a valid sigil delimiter after `~`" 55 + ExpectedWhitespaceAfterTripleQuote -> 56 + "Expected whitespace after a triple quote" 57 + InvalidRadix(radix:) -> "Invalid numeric radix: " <> radix 58 + InvalidTripleQuotedStringIndentation(expected_indentation:, line:) -> 59 + "Invalid triple-quoted string: Expected the indentation `" 60 + <> expected_indentation 61 + <> "` preceding the line `" 62 + <> line 63 + <> "`" 64 + NumberCannotEndAfterRadix -> 65 + "Number cannot end directly after radix specification" 66 + NumericSeparatorNotAllowed -> "Numeric separator is not allowed here" 67 + UnknownCharacter(character:) -> 68 + "Unexpected character: `" <> character <> "`" 69 + UnterminatedCharacter -> "Unterminated character literal" 70 + UnterminatedEscapeSequence -> "Unterminated escape sequence" 71 + } 72 + } 73 + 49 74 pub type Token { 50 75 // Whitespace and comments 51 76 Whitespace(String)