Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

Fail compilation of no documentation on a public item #105

Merged
merged 3 commits into from
May 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ language: rust

matrix:
include:
- rust: 1.14.0
os: linux
dist: trusty
- rust: 1.14.0
os: osx
- rust: 1.15.0
os: linux
dist: trusty
Expand Down
3 changes: 3 additions & 0 deletions source/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
//! much as possible zero copy. We try to enforce the zero copy property to
//! hold.

// Force all public items to be documented.
#![deny(missing_docs)]

// Increase the macro recursion limit.
#![recursion_limit="128"]

Expand Down
24 changes: 24 additions & 0 deletions source/rules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,30 @@ use super::ast::Expression;
use super::internal::*;
use super::tokens::Span;

/// The `root` parser is the axiom of the grammar, i.e. the entry
/// point of all the parsers.
///
/// # Examples
///
/// ```
/// # extern crate tagua_parser;
/// use tagua_parser::ast::{
/// Expression,
/// Literal
/// };
/// use tagua_parser::tokens::{
/// Span,
/// Token
/// };
/// use tagua_parser::rules::root;
///
/// # fn main() {
/// let input = Span::new(b"'Hello, World!'");
/// let output = Expression::Literal(Literal::String(Token::new(b"Hello, World!".to_vec(), input)));
///
/// assert_eq!(root(input), output);
/// # }
/// ```
pub fn root(input: Span) -> Expression {
match expressions::expression(input) {
Result::Done(_, ast) => ast,
Expand Down
8 changes: 7 additions & 1 deletion source/rules/statements/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ use super::super::ast::Statement;
use super::super::tokens;
use super::super::tokens::Span;

named!(
named_attr!(
#[doc="
Recognize a group of statements.
"],
pub compound_statement<Span, Vec<Statement>>,
map_res!(
terminated!(
Expand All @@ -58,6 +61,9 @@ named!(
);

named!(
#[doc="
Recognize a statement.
"],
pub statement<Span, Statement>,
alt!(
call!(function::function)
Expand Down
15 changes: 15 additions & 0 deletions source/tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,21 @@ pub struct Token<'a, T> {
}

impl<'a, T> Token<'a, T> {
/// Associate a span to a datum, i.e. to the token value.
///
/// # Examples
///
/// ```
/// # extern crate tagua_parser;
/// use tagua_parser::tokens::{
/// Span,
/// Token
/// };
///
/// # fn main() {
/// let token = Token::new(42, Span::new(b"42"));
/// # }
/// ```
pub fn new(value: T, span: Span<'a>) -> Self {
Token {
value: value,
Expand Down