Skip to content

Commit 779e807

Browse files
committed
docs on span
1 parent d931ffe commit 779e807

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ SQL was first standardized in 1987, and revisions of the standard have been
128128
published regularly since. Most revisions have added significant new features to
129129
the language, and as a result no database claims to support the full breadth of
130130
features. This parser currently supports most of the SQL-92 syntax, plus some
131-
syntax from newer versions that have been explicitly requested, plus some MSSQL,
132-
PostgreSQL, and other dialect-specific syntax. Whenever possible, the [online
133-
SQL:2016 grammar][sql-2016-grammar] is used to guide what syntax to accept.
131+
syntax from newer versions that have been explicitly requested, plus various
132+
other dialect-specific syntax. Whenever possible, the [online SQL:2016
133+
grammar][sql-2016-grammar] is used to guide what syntax to accept.
134134

135135
Unfortunately, stating anything more specific about compliance is difficult.
136136
There is no publicly available test suite that can assess compliance

src/ast/spans.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@ fn union_spans<I: Iterator<Item = Span>>(iter: I) -> Span {
2727

2828
/// A trait for AST nodes that have a source span for use in diagnostics.
2929
///
30-
/// Source spans are not guaranteed to be entirely accurate. They may
31-
/// be missing keywords or other tokens. Some nodes may not have a computable
32-
/// span at all, in which case they return [`Span::empty()`].
30+
/// Note: Source spans are likely not currently entirely accurate. They may
31+
/// 1. Be missing keywords or other tokens.
32+
/// 2. Not have span information at all, in which case they return [`Span::empty()`].
3333
///
34-
/// Some impl blocks may contain doc comments with information
34+
/// See [this ticket] for more information.
35+
///
36+
/// Note Some impl blocks may contain doc comments with information
3537
/// on which nodes are missing spans.
38+
///
39+
/// [this ticket]: https://github.com/apache/datafusion-sqlparser-rs/issues/1548
3640
pub trait Spanned {
37-
/// Compute the source span for this AST node, by recursively
41+
/// Return the the source [`Span`] for this AST node, by recursively
3842
/// combining the spans of its children.
3943
fn span(&self) -> Span;
4044
}

src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
//! 1. [`Parser::parse_sql`] and [`Parser::new`] for the Parsing API
2626
//! 2. [`ast`] for the AST structure
2727
//! 3. [`Dialect`] for supported SQL dialects
28+
//! 4. [`Spanned`] for source text locations
29+
//!
30+
//! [`Spanned`]: ast::Spanned
2831
//!
2932
//! # Example parsing SQL text
3033
//!

0 commit comments

Comments
 (0)