Skip to main content

blue_lang_syntax/
lib.rs

1//! blue's surface syntax.
2//!
3//! Blue is a general-purpose language whose surface is Ruby/Elixir-shaped
4//! and whose **program is a tatara-lisp value**. This crate is the join:
5//! it lexes blue source and parses it directly into `tatara_lisp::Sexp`.
6//!
7//! There is deliberately no private blue AST in between. Tenet 1 of
8//! `theory/BLUE.md` is that blue source parses *to tatara-lisp*, and an
9//! intermediate tree would make homoiconicity a conversion step rather
10//! than an identity — the difference between blue's macro story working
11//! and merely being asserted.
12//!
13//! ```
14//! use blue_lang_syntax::parse_expr;
15//! let form = parse_expr("user.greet(1)").unwrap();
16//! assert_eq!(form.to_string(), "(greet user 1)");
17//! ```
18
19pub mod doc;
20pub mod forms;
21pub mod kigou;
22pub mod lex;
23pub mod parse;
24pub mod scope;
25pub mod spelling;
26pub mod test_form;
27pub mod test_stack;
28pub mod words;
29pub mod yakugo;
30
31pub use forms::{Form, FORMS};
32pub use lex::{lex, LexError, Span, Token, TokenKind};
33// Re-exported so a consumer walking blue trees does not have to depend on
34// tatara-lisp directly just to name the node types blue emits.
35pub use parse::{
36    comments, constant_text, is_callable_name, is_index_key, is_reserved_word, keyword_doc,
37    parse_expr, parse_program, parse_program_documented, parse_program_documented_with_depth,
38    parse_program_in, parse_program_spanned, parse_program_spanned_with_depth, parse_program_tree,
39    parse_program_tree_in, parse_program_tree_with_depth, parse_program_with_depth,
40    parses_on_this_thread, qualified, qualify, spelling_notes, Comment, Infix, ParseError,
41    BLOCK_KEYWORDS, BUILTIN_QUALIFIER, INFIX, LOWERED_ASSERT, LOWERED_ASSERT_PANICS,
42    LOWERED_ATTEMPTED, LOWERED_CONCAT, LOWERED_ENSURE, LOWERED_ERROR_MATCH, LOWERED_FAILED,
43    LOWERED_FIELD, LOWERED_HEADS, LOWERED_KWARGS, LOWERED_MAP, LOWERED_MERGE, LOWERED_OPTIONAL_ARG,
44    LOWERED_OPTIONAL_ARITY, LOWERED_RERAISE, LOWERED_SPLICE, LOWERED_TEST_META, MASTER_VERBS,
45    MAX_EXPR_DEPTH, OPERATOR_KEYWORDS, OPTIONAL_MARKER, QUALIFIER, RESCUED, SURFACE_KEYWORDS,
46    SYMBOL_SPELLINGS,
47};
48pub use spelling::{Note, Spelling};
49pub use test_form::{is_meta, meta_map, target_key, test_meta, test_parts, TestMeta, TestParts};
50// `Spanned`/`SpannedForm` alongside `Sexp` for the same reason `Sexp` is here:
51// the parser's real output is the spanned tree, and a consumer that wants a
52// position should not have to add a tatara-lisp dependency to name the node it
53// got a span from.
54pub use tatara_lisp::{Atom, Sexp, Spanned, SpannedForm};