def literal
bolt@1.27.0.0 · src/rules/pedantic/fuel.bend:116
import bolt@1.27.0.0/src/rules/pedantic/fuel.bend as Fuel
import Base
import bolt@1.27.0.0/src/finding.bend as F
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
import bolt@1.27.0.0/src/syntax/tree.bend as Tree
import bolt@1.27.0.0/src/rules/tokens.bend as T
116
117
118def literal(aa: Tree.Node, +path: String) -> List<&2, F.Finding>:
119 match aa:
120 case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TNum{}, +t, l, c}}, Tree.NNil{}}:
121 Bool.pick(List<&2, F.Finding>, T.nat_ok(String.to_list(t)),
122 [F.Finding{path, l, c, U32.from_nat(String.length(t)), "fuel",
123 "The fuel is fixed at " ++ t ++ ", so longer input is silently cut short; derive the fuel from the input size."}],
124 [])
125 case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TDotted{}, +t, l, c}},
126 Tree.NCons{Tree.Group{Lex.Tok{ok, +o, ol, oc}, kids, cl}, Tree.NNil{}}}:
127 converted(kids, Bool.and(String.eq(t, "U32.to_nat"), String.eq(o, "(")), l, c, path)
128 case other:
129 Nil{}