Followup to previous commit

This commit is contained in:
Tony Garnock-Jones 2019-08-12 00:09:13 +01:00
parent 0f5f0630d2
commit efd976ed90
2 changed files with 174 additions and 171 deletions

View File

@ -36,14 +36,16 @@
(modify-syntax-entry ?\n "> b" preserves-mode-syntax-table) (modify-syntax-entry ?\n "> b" preserves-mode-syntax-table)
(modify-syntax-entry ?\r "> b" preserves-mode-syntax-table) (modify-syntax-entry ?\r "> b" preserves-mode-syntax-table)
(modify-syntax-entry ?/ "_ 12b" preserves-mode-syntax-table) (modify-syntax-entry ?/ "_ 12b" preserves-mode-syntax-table)
(modify-syntax-entry ?< "(>" preserves-mode-syntax-table)
(modify-syntax-entry ?> ")<" preserves-mode-syntax-table)
(mapcar #'(lambda (x) (modify-syntax-entry x "_" preserves-mode-syntax-table)) (mapcar #'(lambda (x) (modify-syntax-entry x "_" preserves-mode-syntax-table))
'(?- ?_ ?$ ?? ?! ?* ?+ ?~ ?: ?< ?> ?= ?|)) '(?- ?_ ?$ ?? ?! ?* ?+ ?~ ?: ?= ?|))
(mapcar #'(lambda (x) (modify-syntax-entry x "." preserves-mode-syntax-table)) (mapcar #'(lambda (x) (modify-syntax-entry x "." preserves-mode-syntax-table))
'(?.)) '(?.))
(defvar preserves-font-lock-keywords (defvar preserves-font-lock-keywords
(list (list
'("\\_<\\(~\\|[A-Z]\\)[^][)(}{[:space:].\n]*\\>" . font-lock-type-face) '("\\_<\\(~\\|[A-Z]\\)[^][)(}{><[:space:].\n]*\\>" . font-lock-type-face)
'("\\\\[[:space:]]*?\n" . font-lock-warning-face) '("\\\\[[:space:]]*?\n" . font-lock-warning-face)
'("\\." . font-lock-builtin-face) '("\\." . font-lock-builtin-face)
(cons (regexp-opt '("->" (cons (regexp-opt '("->"

View File

@ -1,113 +1,114 @@
@EmacsMode("-*- preserves -*-") @<EmacsMode "-*- preserves -*-">
@"Expects placeholder mapping of:" @"Expects placeholder mapping of:"
@"{ 0: discard, 1: capture, 2: observe }" @"{ 0: discard, 1: capture, 2: observe }"
{ {
annotation1: Test(#hex{055361626339} @"abc" 9) annotation1: <Test #hex{055361626339} @"abc" 9>
annotation2: Test(#hex{05536162630553646566929005517890} @"abc" @"def" [[] @"x" []]) annotation2: <Test #hex{05536162630553646566929005517890} @"abc" @"def" [[] @"x" []]>
annotation3: Test(#hex{050531320505333435} @@1 2 @@3 4 5) annotation3: <Test #hex{050531320505333435} @@1 2 @@3 4 5>
annotation4: Test(#hex{b4 05 72616b 7161 05 726176 31 05 72626b 7162 05 726276 32} annotation4: <Test #hex{b4 05 72616b 7161 05 726176 31 05 72626b 7162 05 726276 32}
{@ak a: @av 1 @bk b: @bv 2}) {@ak a: @av 1 @bk b: @bv 2}>
annotation5: @"AMBIGUOUS! Should `ar` attach to `R` or `R(...)`?" Test(#hex{} @ar R(@af f)) annotation5: <Test #hex{05726172827152057261667166} @ar <R @af f>>
bytes1: Test(#hex{26626865626c6c616f04} #"hello") annotation6: <Test #hex{82057261727152057261667166} <@ar R @af f>>
bytes2: Test(#hex{6568656c6c6f} #"hello") bytes1: <Test #hex{26626865626c6c616f04} #"hello">
bytes3: Test(#hex{63414243} #"ABC") bytes2: <Test #hex{6568656c6c6f} #"hello">
bytes4: Test(#hex{63414243} #hex{414243}) bytes3: <Test #hex{63414243} #"ABC">
bytes5: Test(#hex{63414a4e} #hex{ 41 4A 4e }) bytes4: <Test #hex{63414243} #hex{414243}>
bytes6: @"Bytes must be 2-digits entire" ParseError("#hex{414 243}") bytes5: <Test #hex{63414a4e} #hex{ 41 4A 4e }>
bytes7: Test(#"\x66corymb" #base64{Y29yeW1i}) bytes6: @"Bytes must be 2-digits entire" <ParseError "#hex{414 243}">
bytes8: Test(#"\x66corymb" #base64{Y29 yeW 1i}) bytes7: <Test #"\x66corymb" #base64{Y29yeW1i}>
bytes9: Test(#"\x62Hi" #base64{SGk=}) bytes8: <Test #"\x66corymb" #base64{Y29 yeW 1i}>
bytes10: Test(#"\x62Hi" #base64{SGk}) bytes9: <Test #"\x62Hi" #base64{SGk=}>
bytes11: Test(#"\x62Hi" #base64{S G k}) bytes10: <Test #"\x62Hi" #base64{SGk}>
bytes12: @"Bytes syntax only supports \\x, not \\u" ParseError("#\"\\u6c34\"") bytes11: <Test #"\x62Hi" #base64{S G k}>
bytes13: Test(#hex{6f 11 61 62 63 6c 34 f0 5c 2f 22 08 0c 0a 0d 09 78 79 7a} #"abc\x6c\x34\xf0\\/\"\b\f\n\r\txyz") bytes12: @"Bytes syntax only supports \\x, not \\u" <ParseError "#\"\\u6c34\"">
bytes13: <Test #hex{6f 11 61 62 63 6c 34 f0 5c 2f 22 08 0c 0a 0d 09 78 79 7a} #"abc\x6c\x34\xf0\\/\"\b\f\n\r\txyz">
dict0: Test(#hex{b0} {}) dict0: <Test #hex{b0} {}>
dict1: Test(#hex{b8 7161 31 5162 01 93313233 6163 b2 7a66697273742d6e616d65 59456c697a6162657468 b2 777375726e616d65 59426c61636b77656c6c} { a: 1 "b": #true [1 2 3]: c { first-name: "Elizabeth" }: { surname: "Blackwell" } }) dict1: <Test #hex{b8 7161 31 5162 01 93313233 6163 b2 7a66697273742d6e616d65 59456c697a6162657468 b2 777375726e616d65 59426c61636b77656c6c} { a: 1 "b": #true [1 2 3]: c { first-name: "Elizabeth" }: { surname: "Blackwell" } }>
double1: Test(#hex{033ff0000000000000} 1.0) double1: <Test #hex{033ff0000000000000} 1.0>
double2: Test(#hex{03fe3cb7b759bf0426} -1.202e300) double2: <Test #hex{03fe3cb7b759bf0426} -1.202e300>
float1: Test(#hex{023f800000} 1.0f) float1: <Test #hex{023f800000} 1.0f>
int-257: Test(#hex{42feff} -257) int-257: <Test #hex{42feff} -257>
int-256: Test(#hex{42ff00} -256) int-256: <Test #hex{42ff00} -256>
int-255: Test(#hex{42ff01} -255) int-255: <Test #hex{42ff01} -255>
int-254: Test(#hex{42ff02} -254) int-254: <Test #hex{42ff02} -254>
int-129: Test(#hex{42ff7f} -129) int-129: <Test #hex{42ff7f} -129>
int-128: Test(#hex{4180} -128) int-128: <Test #hex{4180} -128>
int-127: Test(#hex{4181} -127) int-127: <Test #hex{4181} -127>
int-4: Test(#hex{41fc} -4) int-4: <Test #hex{41fc} -4>
int-3: Test(#hex{3d} -3) int-3: <Test #hex{3d} -3>
int-2: Test(#hex{3e} -2) int-2: <Test #hex{3e} -2>
int-1: Test(#hex{3f} -1) int-1: <Test #hex{3f} -1>
int0: Test(#hex{30} 0) int0: <Test #hex{30} 0>
int1: Test(#hex{31} 1) int1: <Test #hex{31} 1>
int12: Test(#hex{3c} 12) int12: <Test #hex{3c} 12>
int13: Test(#hex{410d} 13) int13: <Test #hex{410d} 13>
int127: Test(#hex{417f} 127) int127: <Test #hex{417f} 127>
int128: Test(#hex{420080} 128) int128: <Test #hex{420080} 128>
int255: Test(#hex{4200ff} 255) int255: <Test #hex{4200ff} 255>
int256: Test(#hex{420100} 256) int256: <Test #hex{420100} 256>
int32767: Test(#hex{427fff} 32767) int32767: <Test #hex{427fff} 32767>
int32768: Test(#hex{43008000} 32768) int32768: <Test #hex{43008000} 32768>
int65535: Test(#hex{4300ffff} 65535) int65535: <Test #hex{4300ffff} 65535>
int65536: Test(#hex{43010000} 65536) int65536: <Test #hex{43010000} 65536>
int131072: Test(#hex{43020000} 131072) int131072: <Test #hex{43020000} 131072>
list0: Test(#hex{90} []) list0: <Test #hex{90} []>
list1: Test(#hex{293132333404} [1 2 3 4]) list1: <Test #hex{293132333404} [1 2 3 4]>
list2: Test(#hex{2925636162630425636465660404} ["abc" "def"]) list2: <Test #hex{2925636162630425636465660404} ["abc" "def"]>
list3: Test(#hex{2992516131925162329251633304} [["a" 1] ["b" 2] ["c" 3]]) list3: <Test #hex{2992516131925162329251633304} [["a" 1] ["b" 2] ["c" 3]]>
list4: Test(#hex{9431323334} [1 2 3 4]) list4: <Test #hex{9431323334} [1 2 3 4]>
list4a: Test(#hex{9431323334} [1, 2, 3, 4]) list4a: <Test #hex{9431323334} [1, 2, 3, 4]>
list5: Test(#hex{943e3f3031} [-2 -1 0 1]) list5: <Test #hex{943e3f3031} [-2 -1 0 1]>
list6: Test(#hex{97 5568656c6c6f 757468657265 65776f726c64 90 a0 01 00} ["hello" #"there" world [] #set{} #true #false]) list6: <Test #hex{97 5568656c6c6f 757468657265 65776f726c64 90 a0 01 00} ["hello" #"there" world [] #set{} #true #false]>
list7: Test(#hex{93 73616263 732e2e2e 73646566} [abc ... def]) list7: <Test #hex{93 73616263 732e2e2e 73646566} [abc ... def]>
placeholder0: Test(#hex{10} discard) placeholder0: <Test #hex{10} discard>
placeholder1: Test(#hex{11} capture) placeholder1: <Test #hex{11} capture>
placeholder2: Test(#hex{12} observe) placeholder2: <Test #hex{12} observe>
record1: Test(#hex{82118110} capture(discard())) record1: <Test #hex{82118110} <capture <discard>>>
record2: Test(#hex{82 12 83 75737065616b 81 10 82 11 81 10} observe(speak(discard(), capture(discard())))) record2: <Test #hex{82 12 83 75737065616b 81 10 82 11 81 10} <observe <speak <discard>, <capture <discard>>>>>
record3: Test(#hex{85 95 767469746c6564 76706572736f6e 32 757468696e67 31 4165 59426c61636b77656c6c 84 7464617465 42071d 32 33 524472} [titled person 2 thing 1](101 "Blackwell" date(1821 2 3) "Dr")) record3: <Test #hex{85 95 767469746c6564 76706572736f6e 32 757468696e67 31 4165 59426c61636b77656c6c 84 7464617465 42071d 32 33 524472} <[titled person 2 thing 1] 101 "Blackwell" <date 1821 2 3> "Dr">>
record4: Test(#hex{8110} discard()) record4: <Test #hex{8110} <discard>>
record5: Test(#hex{823790} 7[]) record5: <Test #hex{823790} <7[]>>
record6: Test(#hex{8210787375727072697365} discard(surprise)) record6: <Test #hex{8210787375727072697365} <discard surprise>>
record7: Test(#hex{835761537472696e673334} "aString"(3 4)) record7: <Test #hex{835761537472696e673334} <"aString" 3 4>>
record8: Test(#hex{8381103334} discard()(3, 4)) record8: <Test #hex{8381103334} <<discard> 3 4>>
set0: Test(#hex{a0} #set{}) set0: <Test #hex{a0} #set{}>
set1: Test(#hex{a3313233} {1 2 3}) set1: <Test #hex{a3313233} {1 2 3}>
set1a: Test(#hex{a3313233} #set{1 2 3}) set1a: <Test #hex{a3313233} #set{1 2 3}>
stream1: @"Chunk must be bytes" DecodeError(#hex{25516104}) stream1: @"Chunk must be bytes" <DecodeError #hex{25516104}>
stream2: @"Chunk must be bytes" DecodeError(#hex{25716104}) stream2: @"Chunk must be bytes" <DecodeError #hex{25716104}>
stream3: @"Chunk must be bytes" DecodeError(#hex{26516104}) stream3: @"Chunk must be bytes" <DecodeError #hex{26516104}>
stream4: @"Chunk must be bytes" DecodeError(#hex{26716104}) stream4: @"Chunk must be bytes" <DecodeError #hex{26716104}>
stream5: @"Chunk must be bytes" DecodeError(#hex{27516104}) stream5: @"Chunk must be bytes" <DecodeError #hex{27516104}>
stream6: @"Chunk must be bytes" DecodeError(#hex{27716104}) stream6: @"Chunk must be bytes" <DecodeError #hex{27716104}>
stream7: @"Missing end byte" DecodeShort(#hex{290000}) stream7: @"Missing end byte" <DecodeShort #hex{290000}>
stream8: @"Missing element" DecodeShort(#hex{930000}) stream8: @"Missing element" <DecodeShort #hex{930000}>
string0: Test(#hex{50} "") string0: <Test #hex{50} "">
string0a: Test(#hex{2504} "") string0a: <Test #hex{2504} "">
string1: Test(#hex{25626865626c6c616f04} "hello") string1: <Test #hex{25626865626c6c616f04} "hello">
string2: Test(#hex{25626865636c6c6f04} "hello") string2: <Test #hex{25626865636c6c6f04} "hello">
string3: Test(#hex{5568656c6c6f} "hello") string3: <Test #hex{5568656c6c6f} "hello">
string4: Test(#hex{5f 14 616263e6b0b4e6b0b45c2f22080c0a0d0978797a} "abc\u6c34\u6C34\\/\"\b\f\n\r\txyz") string4: <Test #hex{5f 14 616263e6b0b4e6b0b45c2f22080c0a0d0978797a} "abc\u6c34\u6C34\\/\"\b\f\n\r\txyz">
string5: Test(#hex{54f09d849e} "\uD834\uDD1E") string5: <Test #hex{54f09d849e} "\uD834\uDD1E">
symbol0: Test(#hex{70} ||) symbol0: <Test #hex{70} ||>
symbol1: Test(#hex{27626865626c6c616f04} hello) symbol1: <Test #hex{27626865626c6c616f04} hello>
symbol2: Test(#hex{7568656c6c6f} hello) symbol2: <Test #hex{7568656c6c6f} hello>
value1: Test(#"\x66corymb" #value#"fcorymb") value1: <Test #"\x66corymb" #value#"fcorymb">
value2: Test(#"\x01" #value#"\x01") value2: <Test #"\x01" #value#"\x01">
value3: Test(#"\x01" #value#base64{AQ}) value3: <Test #"\x01" #value#base64{AQ}>
value4: Test(#"\x01" #value#base64{AQ==}) value4: <Test #"\x01" #value#base64{AQ==}>
value5: Test(#"\x01" #value #base64{AQ==}) value5: <Test #"\x01" #value #base64{AQ==}>
longlist14: Test(#hex{9e0000000000000000000000000000} longlist14: <Test #hex{9e0000000000000000000000000000}
[#false #false #false #false #false [#false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false]) #false #false #false #false]>
longlist15: Test(#hex{9f0f000000000000000000000000000000} longlist15: <Test #hex{9f0f000000000000000000000000000000}
[#false #false #false #false #false [#false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false]) #false #false #false #false #false]>
longlist100: longlist100:
Test(#hex{9f64 <Test #hex{9f64
00000000000000000000 00000000000000000000
00000000000000000000 00000000000000000000
00000000000000000000 00000000000000000000
@ -127,9 +128,9 @@
#false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false]) #false #false #false #false #false #false #false #false #false #false]>
longlist200: longlist200:
Test(#hex{9fc801 <Test #hex{9fc801
00000000000000000000 00000000000000000000
00000000000000000000 00000000000000000000
00000000000000000000 00000000000000000000
@ -169,9 +170,9 @@
#false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false #false
#false #false #false #false #false #false #false #false #false #false]) #false #false #false #false #false #false #false #false #false #false]>
rfc8259-example1: NondeterministicTest( rfc8259-example1: <NondeterministicTest
#hex{} #hex{}
{ {
"Image": { "Image": {
@ -186,9 +187,9 @@
"Animated" : false, "Animated" : false,
"IDs": [116, 943, 234, 38793] "IDs": [116, 943, 234, 38793]
} }
}) }>
rfc8259-example2: NondeterministicTest( rfc8259-example2: <NondeterministicTest
#hex{} #hex{}
[ [
{ {
@ -211,6 +212,6 @@
"Zip": "94085", "Zip": "94085",
"Country": "US" "Country": "US"
} }
]) ]>
} }