Exemple #1
0
def _ParseAndMakeTypes(schema_path, root):
    module = asdl.parse(schema_path)

    app_types = {}

    # Check for type errors
    if not asdl.check(module, app_types):
        raise AssertionError('ASDL file is invalid')
    py_meta.MakeTypes(module, root, app_types)
Exemple #2
0
def _ParseAndMakeTypes(f, root):
    module = asdl.parse(f)

    app_types = {'id': asdl.UserType(Id)}

    # Check for type errors
    if not asdl.check(module, app_types):
        raise AssertionError('ASDL file is invalid')
    py_meta.MakeTypes(module, root, app_types)
Exemple #3
0
def _LoadSchema(f):
    module = asdl.parse(f)

    app_types = {'id': asdl.UserType(Id)}
    type_lookup = asdl.ResolveTypes(module, app_types)

    # Check for type errors
    if not asdl.check(module, app_types):
        raise AssertionError('ASDL file is invalid')
    return module, type_lookup
Exemple #4
0
def LoadSchema(f):
    app_types = {'id': asdl.UserType(Id)}

    asdl_module = asdl.parse(f)

    if not asdl.check(asdl_module, app_types):
        raise AssertionError('ASDL file is invalid')

    type_lookup = asdl.ResolveTypes(asdl_module, app_types)
    return asdl_module, type_lookup
Exemple #5
0
def _ParseAndMakeTypes(f, root):
  # TODO: A better syntax for this might be:
  #
  #     id = external
  #
  # in osh.asdl.  Then we can show an error if it's not provided.
  app_types = {'id': asdl.UserType(Id)}

  module = asdl.parse(f)

  # Check for type errors
  if not asdl.check(module, app_types):
    raise AssertionError('ASDL file is invalid')
  py_meta.MakeTypes(module, root, app_types)
Exemple #6
0
def _ParseAndMakeTypes(schema_path, root):
    module = asdl.parse(schema_path)

    app_types = {
        'identifier': asdl.UserType(Identifier),
        'bytes': asdl.UserType(Bytes),
        'object': asdl.UserType(PyObject),
        'constant': asdl.UserType(Constant),
        'singleton': asdl.UserType(Singleton),
    }

    # Check for type errors
    if not asdl.check(module, app_types):
        raise AssertionError('ASDL file is invalid')
    py_meta.MakeTypes(module, root, app_types)