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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//! Inline token types and specifications
//!
//! This module defines the token types for inline parsing. Inline elements are span-based
//! elements that can start and end at arbitrary positions within text content. Unlike the
//! line-based tokens (core and line), inline tokens operate at the character level and can
//! be nested within each other.
//!
//! For the complete inline grammar specification, see specs/v1/grammar-inline.lex.
//!
//! Related token modules:
//! - [core](super::core) - Character and word-level tokens from the logos lexer
//! - [line](super::line) - Line-based tokens for the main parser
//!
//! Inline Token Types
//!
//! These are the inline element types supported by lex:
//!
//! - Strong: *text* (bold/emphasis)
//! - Emphasis: _text_ (italic)
//! - Code: `text` (monospace, literal)
//! - Math: #formula# (mathematical notation, literal)
//! - Reference: [target] (links, citations, footnotes)
//!
//! References support multiple subtypes including:
//! - Citations: [@key] or [@key1; @key2, pp. 42-45]
//! - Annotation references: [::label]
//! - Footnotes: [42]
//! - Session references: [#2.1]
//! - URLs: [https://example.com]
//! - File paths: [./path/to/file]
//! - TK placeholders: [TK] or [TK-identifier]
//! - General references: [Section Title]
//!
//! Inline elements have these properties:
//! - Clear start and end markers (single character tokens)
//! - Can be nested (except literal types)
//! - Cannot break parent element boundaries
//! - No space allowed between marker and content
//!
//! Token Specifications
//!
//! Each inline type is defined by an InlineSpec that specifies:
//! - The kind of inline element (from InlineKind enum)
//! - Start and end tokens (characters)
//! - Whether it's literal (no nested parsing inside)
//! - Optional post-processing callback for complex logic
//!
//! Citation Parsing
//!
//! Citations are a specialized form of reference that follow academic citation format.
//! The reference token [target] is post-processed to detect citations starting with @.
//! Citation parsing is handled by [crate::lex::inlines::citations] which extracts:
//! - Multiple citation keys (separated by ; or ,)
//! - Optional page locators (p. or pp. followed by page ranges)
//! - Page ranges in various formats: single pages, ranges, or lists
/// The type of inline element