[][src]Crate luaparse

A Lua 5.3 parser crate.

To get started:

use luaparse::{parse, HasSpan};
use luaparse::error::Error;

let buf = r#"
local a = 42
local b = 24

for i = 1, 100, 1 do
  b = a - b + i
end

print(b)
"#;

match parse(buf) {
    Ok(block) => println!("{}", block),
    Err(e) => eprintln!("{:#}", Error::new(e.span(), e).with_buffer(buf)),
}

Modules

ast

Syntax tree nodes.

error

Fancy error printing.

token

Tokens.

Structs

InputCursor

An input cursor.

Lexer

The lexer.

LexerError

An error returned by the lexer.

Parser

The parser.

Position

A position in the code.

Span

A span, consisting of a starting and an ending position, inclusive.

Enums

LexerErrorKind

A enum of error kinds returned by the lexer.

ParseError

The error type returned by the parser.

Traits

AstDescend

The trait implemented by non-terminal syntax tree nodes to walk through the children of the node.

HasSpan

A trait implemented by types that have a Span associated with them.

VisitorMut

The trait intended to be implemented by visitors.

Functions

parse

Parses the input as a Lua chunk.