Crate weedle [] [src]

Weedle - A WebIDL Parser

Parses valid WebIDL definitions & produces a data structure starting from Definitions.

Example

extern crate weedle;

let parsed = weedle::parse("
    interface Window {
        readonly attribute Storage sessionStorage;
    };
").unwrap();
println!("{:?}", parsed);

Note: This parser tries to follow the grammar given at WebIDL but is not one-to-one. Makes necessary assumptions as per the real world WebIDL definitions.

First, the parser only allows stricter attributes defined in the grammar.

Second, No inner [attributes] are allowed. For example the following is allowed:

[attributes] attribute Type identifier instead of

[attributes] attribute AttributedType AttributeName

where AttributedType is [attribute] Type and AttributeName is one of required|identifier.

Using attributes within declaration is redundant. Only preceding attributes to declarations & arguments are considered.

Also identifier takes in any valid value regardless of whether it is keyword or not.

Modules

argument
attribute
common
dictionary
interface
literal
mixin
namespace
term
types

Macros

opt_flat

Return valid option as it is & convert Error to None

term
test_variants
weedle
ws

ws! also ignores line & block comments

Structs

CallbackDefinition

Parses [attributes]? callback identifier = type ( (arg1, arg2, ..., argN)? );

CallbackInterfaceDefinition

Parses [attributes]? callback interface identifier ( : inheritance )? { members };

CompleteStr

Holds a complete String, for which the at_eof method always returns true

Definitions

Parses WebIDL definitions. It is the root struct for a complete WebIDL definition.

DictionaryDefinition

Parses [attributes]? dictionary identifier ( : inheritance )? { members };

EnumDefinition

Parses [attributes]? enum identifier { values };

IncludesStatementDefinition

Parses [attributes]? identifier includes identifier;

InterfaceDefinition

Parses [attributes]? interface identifier ( : inheritance )? { members };

InterfaceMixinDefinition

Parses [attributes]? interface mixin identifier { members };

NamespaceDefinition

Parses [attributes]? namespace identifier { members };

PartialDictionaryDefinition

Parses [attributes]? partial dictionary identifier { members };

PartialInterfaceDefinition

Parses [attributes]? partial interface identifier { members };

PartialInterfaceMixinDefinition

Parses [attributes]? partial interface mixin identifier { members };

PartialNamespaceDefinition

Parses [attributes]? partial namespace identifier { members };

TypedefDefinition

Parses [attributes]? typedef type identifier;

Enums

Definition

Parses a definition

Traits

Parse

Functions

parse

A convenient parse function

Type Definitions

EnumValueList

Parses a non-empty enum value list

IResult

Holds the result of parsing functions