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
/// Contains all structures related to the AST for the WebIDL grammar.
/// Contains the visitor trait needed to traverse the AST and helper walk functions.
pub use ParseError;
use ;
/// The result that is returned when an input string is parsed. If the parse succeeds, the `Ok`
/// result will be a vector of definitions representing the AST. If the parse fails, the `Err` will
/// be either an error from the lexer or the parser.
pub type ParseResult = ;
/// Parses a given input string and returns an AST.
///
/// # Example
///
/// ```
/// use webidl::*;
/// use webidl::ast::*;
///
/// let result = parse_string("[Attribute] interface Node { };");
///
/// assert_eq!(result,
/// Ok(vec![Definition::Interface(Interface::NonPartial(NonPartialInterface {
/// extended_attributes: vec![
/// ExtendedAttribute::NoArguments(
/// Other::Identifier("Attribute".to_string()))],
/// inherits: None,
/// members: vec![],
/// name: "Node".to_string()
/// }))]));
/// ```