An Erlang lexer and syntax highlighter in Gleam

Add roundtrip tests

+98
+12
test/pearl_test.gleam
··· 33 33 assert found_errors == errors 34 34 } 35 35 36 + pub fn stdlib_ffi_roundtrip_test() { 37 + let assert Ok(stdlib_ffi_file) = 38 + simplifile.read("build/packages/gleam_stdlib/src/gleam_stdlib.erl") 39 + 40 + assert_roundtrip(stdlib_ffi_file, False) 41 + } 42 + 43 + pub fn tokens_roundtrip_test() { 44 + let assert Ok(tokens_file) = simplifile.read("test/tokens.txt") 45 + assert_roundtrip(tokens_file, False) 46 + } 47 + 36 48 pub fn unknown_character_test() { 37 49 let src = "a&b" 38 50 assert_errors(src, [pearl.UnknownCharacter("&")])
+86
test/tokens.txt
··· 1 + % some kind of comment 2 + %% doc comment 3 + %%%mod comment 4 + 5 + $a 6 + 1323 123_456_789 16#abc_def_138 2#101_101 7 + 1.3 1.2e3_0 8 + hello@world 'Atom with? special-characters!' 9 + "A string!" 10 + "This one 11 + spans multiple 12 + 13 + lines!" 14 + ~/I need "quotes"/ ~<This is also possible> ~b"Bit array" 15 + Variable Something_else@5 16 + 17 + after 18 + begin 19 + case 20 + catch 21 + cond 22 + else 23 + end 24 + fun 25 + if 26 + let 27 + maybe 28 + of 29 + receive 30 + try 31 + when 32 + ( 33 + ) 34 + { 35 + } 36 + [ 37 + ] 38 + , 39 + ; 40 + : 41 + . 42 + -> 43 + << 44 + >> 45 + # 46 + :: 47 + .. 48 + ... 49 + || 50 + => 51 + := 52 + <- 53 + <= 54 + | 55 + == 56 + /= 57 + =< 58 + < 59 + >= 60 + > 61 + =:= 62 + =/= 63 + + 64 + - 65 + * 66 + / 67 + bnot 68 + div 69 + rem 70 + band 71 + bor 72 + bxor 73 + bsl 74 + bsr 75 + not 76 + and 77 + or 78 + xor 79 + andalso 80 + orelse 81 + ++ 82 + -- 83 + ?= 84 + ? 85 + ! 86 + =