Search in sources :

Example 1 with Package

use of ceylon.language.meta.declaration.Package in project ceylon by eclipse.

the class DeclarationParser method package_.

private Declaration package_(Module module) {
    if (!at(':')) {
        throw parseError("Expecting a colon at start of package");
    }
    String packageName;
    boolean expectColon = false;
    if (at(':')) {
        packageName = module.getName();
    } else if (at('.')) {
        packageName = packageName();
        expectColon = true;
    } else {
        String p = packageName();
        if (p.isEmpty()) {
            packageName = module.getName();
        } else {
            packageName = module.getName() + '.' + p;
        }
        expectColon = true;
    }
    Package package_ = makePackage(module, packageName);
    if (atEnd()) {
        return package_;
    } else if (expectColon && !at(':')) {
        throw parseError("Expecting a colon at end of package");
    }
    return declaration(package_);
}
Also used : Package(ceylon.language.meta.declaration.Package)

Aggregations

Package (ceylon.language.meta.declaration.Package)1