1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) Ankit Chaubey <ankitchaubey.dev@gmail.com>
// SPDX-License-Identifier: MIT OR Apache-2.0
// NOTE:
// The "Layer" project is no longer maintained or supported.
// Its original purpose for personal SDK/APK experimentation and learning
// has been fulfilled.
//
// Please use Ferogram instead:
// https://github.com/ankit-chaubey/ferogram
// Ferogram will receive future updates and development, although progress
// may be slower.
//
// Ferogram is an async Telegram MTProto client library written in Rust.
// Its implementation follows the behaviour of the official Telegram clients,
// particularly Telegram Desktop and TDLib, and aims to provide a clean and
// modern async interface for building Telegram clients and tools.
//! Parser for Telegram's [Type Language] (TL) schema files.
//!
//! This crate converts raw `.tl` text into a structured [`Definition`] AST
//! which can then be used by code-generators (see `layer-tl-gen`).
//!
//! # Quick start
//!
//! ```rust
//! use layer_tl_parser::parse_tl_file;
//!
//! let src = "user#12345 id:long name:string = User;";
//! for def in parse_tl_file(src) {
//! println!("{:#?}", def.unwrap());
//! }
//! ```
//!
//! [Type Language]: https://core.telegram.org/mtproto/TL
/// Parse error types for TL schema parsing.
use ParseError;
use Definition;
/// Parses a complete TL schema file, yielding [`Definition`]s one by one.
///
/// Lines starting with `//` are treated as comments and skipped.
/// The special `---functions---` and `---types---` section markers switch
/// the [`tl::Category`] applied to the following definitions.
///
/// Returns an iterator of `Result<Definition, ParseError>` so callers can
/// decide whether to skip or hard-fail on bad lines.
+ '_