Пример #1
0
def mdoc_typedef_fp(cv):
	m_subroutine = chain(unit(cv), [mdie_type, mdie_type])

	m_params = bind(m_subroutine, lambda ((cu, die)):
		sequence([mdoc_formalparameter((cu, child)) for child in die.iter_children()])
	)
	m_docParams = bind(m_params, lambda docs: unit(intersperse(docs, P.comma())))
	m_returnType = chain(m_subroutine, [mdie_type, mdoc_typeref])
	
	return bind(m_returnType, lambda ret:
		   bind(m_docParams, lambda params:
		   bind(mdoc_name(cv), lambda name:
		   unit(P.text("typedef ") + ret + P.text(" (*") + name + P.text(") ") + P.text('(') + params + P.text(');')))))
Пример #2
0
def doc_decl_function(retType, fname, params, body):
	assert body
	assert len(body) >= 2
	assert body[0] == '{'
	return retType + P.space() + fname + P.text(" (") + intersperse(params, P.comma()) + P.text(") ") + body
Пример #3
0
def doc_exp_function_call(function_name, argList):
	return function_name + P.text("(") + intersperse(argList, P.comma() + P.space()) + P.text(")")