コード例 #1
0
def metamodel_from_str(lang_desc, metamodel=None, **kwargs):
    """
    Creates a new metamodel from the textX description given as a string.

    Args:
        lang_desc(str): A textX language description.
        metamodel(TextXMetaModel): A metamodel that should be used.
        other params: See TextXMetaModel.

    """
    if not metamodel:
        metamodel = TextXMetaModel(**kwargs)

    language_from_str(lang_desc, metamodel)

    return metamodel
コード例 #2
0
ファイル: metamodel.py プロジェクト: igordejanovic/textX
def metamodel_from_str(lang_desc, metamodel=None, **kwargs):
    """
    Creates a new metamodel from the textX description given as a string.

    Args:
        lang_desc(str): A textX language description.
        metamodel(TextXMetaModel): A metamodel that should be used.
        other params: See TextXMetaModel.

    """

    if not metamodel:
        metamodel = TextXMetaModel(**kwargs)

    language_from_str(lang_desc, metamodel)

    return metamodel
コード例 #3
0
ファイル: metamodel.py プロジェクト: stanislaw/textX
def metamodel_from_str(lang_desc, metamodel=None, **kwargs):
    """
    Creates a new metamodel from the textX description given as a string.

    Args:
        lang_desc(str): A textX language description.
        metamodel(TextXMetaModel): A metamodel that should be used.
        other params: See TextXMetaModel.

    """

    is_main_metamodel = metamodel is None

    if not metamodel:
        metamodel = TextXMetaModel(**kwargs)

    file_name = kwargs.get('file_name')

    language_from_str(lang_desc, metamodel, file_name)

    if is_main_metamodel:
        metamodel.validate_user_classes()

    return metamodel