in python/moz/l10n/formats/mf2/message_parser.py [0:0]
def expression_body(self, ch: str) -> Expression:
arg: str | VariableRef | None = None
arg_end = self.pos
if ch == "$":
arg = self.variable()
arg_end = self.pos
ch = self.skip_opt_space()
elif ch != ":":
arg = self.literal()
arg_end = self.pos
ch = self.skip_opt_space()
if ch == ":":
if arg and self.pos == arg_end:
raise MF2ParseError(self, "Expected space")
function = self.identifier(1)
options = self.options()
else:
function = None
options = {}
self.pos = arg_end
attributes = self.attributes()
self.skip_opt_space()
return Expression(arg, function, options, attributes)