diff --git a/idl/idl_api.ysl2 b/idl/idl_api.ysl2 index f981c18..2afd337 100644 --- a/idl/idl_api.ysl2 +++ b/idl/idl_api.ysl2 @@ -19,6 +19,29 @@ def "func:exists" { // ---------------------------------------------------------------------- // idl-api (ysl2) // ---------------------------------------------------------------------- +template "/" { + choose { + when "func:idl_static_analysis_is_ok()" + apply "/pEpACIDLang", 0 + } +} + +def "func:idl_static_analysis_is_ok" { + const "pepacidlang_count", "count(/pEpACIDLang)"; + const "idl_count", "count(/pEpACIDLang/idl)"; + + choose { + when "$pepacidlang_count < 1" + error > idl_static_analysis_is_ok - root node pEpACIDLang not found + when "$idl_count < 1" + error > idl_static_analysis_is_ok - pEpACIDLang idl data not found, include pEpACIDLang.yml2 exactly once. + when "$idl_count < 1" + error > idl_static_analysis_is_ok - ambiguous idl data, include pEpACIDLang.yml2 exactly once. + otherwise + result "true()"; + } +} + def "func:idl_get_package_name" { result "/pEpACIDLang/package/@name" }