add #![log] pragma

This commit is contained in:
rhiannon morris 2024-04-12 21:49:15 +02:00
parent f56f594839
commit 9d60f366cf
7 changed files with 164 additions and 34 deletions

View file

@ -531,7 +531,51 @@ tests = "parser" :- [
parseMatch input #" load "a.quox"; def b = a.b "#
`([PLoad "a.quox" _,
PD (PDef $ MkPDef (PQ Any _) "b"
(PConcrete Nothing (V (MakePName [< "a"] "b") Nothing _))
PSucceed False Nothing _)])
(PConcrete Nothing (V (MkPName [< "a"] "b") Nothing _))
PSucceed False Nothing _)]),
parseMatch input #" #[main] postulate hi : String "#
`([PD (PDef $ MkPDef (PQ Any _) "hi"
(PPostulate (STRING _))
PSucceed True Nothing _)]),
parseMatch input #" #[compile-scheme "hi"] postulate hi : String "#
`([PD (PDef $ MkPDef (PQ Any _) "hi"
(PPostulate (STRING _))
PSucceed False (Just "hi") _)]),
parseMatch input #" #[main] #[compile-scheme "hi"] postulate hi : String "#
`([PD (PDef $ MkPDef (PQ Any _) "hi"
(PPostulate (STRING _))
PSucceed True (Just "hi") _)]),
parseMatch input #" #[fail] def hi = "hi!!!! uwu" "#
`([PD (PDef $ MkPDef (PQ Any _) "hi"
(PConcrete Nothing (Str "hi!!!! uwu" _))
PFailAny False Nothing _)]),
parseMatch input #" #[fail "type"] def hi = "hi!!!! uwu" "#
`([PD (PDef $ MkPDef (PQ Any _) "hi"
(PConcrete Nothing (Str "hi!!!! uwu" _))
(PFailMatch "type") False Nothing _)]),
parseMatch input #" #[fail] namespace ns { } "#
`([PD (PNs $ MkPNamespace [< "ns"] [] PFailAny _)]),
parseFails input #" #[fail 69] namespace ns { } "#,
parseFails input "#[main]",
parseFails input "#[main] namespace a { } ",
parseFails input #" #[not-an-attr] postulate hi : String "#,
parseFails input #" #[log pop] postulate hi : String "#,
parseMatch input #" #![log pop] "#
`([PD (PPrag (PLogPop _))]),
parseMatch input #" #![log (all, 5)] "#
`([PD (PPrag (PLogPush [SetAll (Element 5 _)] _))]),
parseMatch input #" #![log (default, 69)] "#
`([PD (PPrag (PLogPush [SetDefault (Element 69 _)] _))]),
parseMatch input #" #![log (whnf, 100)] "#
`([PD (PPrag (PLogPush [SetCat (Element "whnf" _) (Element 100 _)] _))]),
parseMatch input #" #![log (all, 5) (default, 69) (whnf, 100)] "#
`([PD (PPrag (PLogPush
[SetAll (Element 5 _), SetDefault (Element 69 _),
SetCat (Element "whnf" _) (Element 100 _)] _))]),
parseFails input #" #![log] "#,
parseFails input #" #![log (non-category, 5)] "#,
parseFails input #" #![log (whnf, 50000000)] "#,
parseFails input #" #![log [0.★⁵]] "#,
parseFails input #" #![main] "#
]
]