yog-script-analyze 0.1.0

Yog Script (.ys, .yns) analyzed: its lexer, parser and syntax tree, names resolved, the class index model — what the build and the editors read a source with.
Documentation
//! `type` — another name for a type.

use crate::ast::DeclKind;
use crate::parser::{PResult, Parser};
use crate::source::token::Punct;
use crate::words::{Role, Word};

pub static WORD: Word = Word {
    text: "type",
    doc: "Another name for a type: `type Grid = Map<Pos, Int>`.",
    reserved: true,
    roles: &[Role::Decl { starts: None, parse }],
};

fn parse(p: &mut Parser) -> PResult<DeclKind> {
    p.bump();
    let name = p.name("a type's name")?;
    let generics = p.generics()?;
    p.need(Punct::Eq)?;
    Ok(DeclKind::Type { name, generics, ty: p.ty()? })
}