Skip to content

Commit 391f32a

Browse files
committed
Write organization and language server TODOs
1 parent e3a7610 commit 391f32a

File tree

6 files changed

+26
-3
lines changed

6 files changed

+26
-3
lines changed

omniwsa-ls/src/main.rs

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ use serde_json::{from_value as from_json, to_value as to_json};
2626
// TODO:
2727
// - Implement text document API, instead of reading from disk.
2828
// - Record spans in tokens.
29+
// - About lazy analyses and ties between syntax and semantics:
30+
// https://rust-analyzer.github.io/blog/2023/12/26/the-heart-of-a-language-server.html
31+
// - To infer imports, it could eagerly parse every Whitespace file. For
32+
// inactive files, only labels would need to be retained, instead of the
33+
// full CST.
2934

3035
fn main() {
3136
if let Err(err) = do_main() {

src/dialects/palaiologos/parse.rs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use crate::{
2727
// - Allow using invalid mnemonics as label defs and refs.
2828
// - Allow adjacent instructions without slashes. At every misplaced mnemonic,
2929
// unless the previous was `rep` or it's used as a label, start a new token.
30+
// - Recover `break:` as `label break`, instead of `jmp reak:`.
3031

3132
/// A parser for the Palaiologos Whitespace assembly dialect.
3233
#[derive(Clone, Debug)]

src/tokens/comment.rs

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ use enumset::{EnumSet, EnumSetType};
66

77
use crate::syntax::{HasError, Pretty};
88

9+
// TODO:
10+
// - Block comments should be parsed into a list or even hierarchy of tokens.
11+
// - Line comments within block comments could be highlighted differently.
12+
913
/// Line comment token (e.g., `#` or `//`).
1014
#[derive(Clone, DebugCustom, PartialEq, Eq)]
1115
pub struct LineCommentToken<'s> {

src/tokens/integer/parse2.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use rug::Integer;
66
use crate::{lex::Scanner, tokens::integer::BaseStyle};
77

88
// TODO:
9+
// - Parse parens as `GroupToken`.
910
// - Implement remainder of parsing, particularly digits.
1011
// - Handle digit separator position errors.
1112
// - Handle `0` octal prefix and `0b`/`0B` prefix as digits for `h`/`H` suffix.

src/tokens/string/tokens.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ use enumset::{EnumSet, EnumSetType};
99
use crate::syntax::{HasError, Pretty};
1010

1111
// TODO:
12+
// - String tokens could be like `format_args!` and have a list of literal
13+
// chunks and escapes, where each escape would have source and parsed
14+
// interpretations and its own errors.
1215
// - Create StringSyntax to describe escapes.
1316
// - How to represent char literals with buggy delimiters, like those allowed
1417
// with littleBugHunter's `'..` pattern? Maybe QuoteStyle::Custom with open
15-
// and close.
18+
// and close. Or just mark it as unterminated and error.
1619
// - Improve Debug for CharData::Byte.
1720

1821
/// A string literal token.

src/tokens/token.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,18 @@ use crate::{
2222
};
2323

2424
// TODO:
25-
// - Whitelips, Lime, and Respace macro definitions.
26-
// - Respace `@define`.
2725
// - Store spans in tokens.
26+
// - `Spanned<T>` or `Loc<T>`.
27+
// - Use length-based spans, instead of offsets, like Rowan. Since the root
28+
// node has the length of the full file, it needs to be `u64`, not shorter.
29+
// - Organization:
30+
// - Merge `Token` into CST.
31+
// - Remove Token suffix from type names. What about `StringToken`?
32+
// - Possibly reference enum variants as `cst::Variant` like `ty::FnDef(_, _)`
33+
// for `rustc_middle::ty::TyKind::FnDef(_, _)`.
34+
// - Features:
35+
// - Whitelips, Lime, and Respace macro definitions.
36+
// - Respace `@define`.
2837
// - Store byte string uniformly (named Text?), instead of a mix of &[u8] and
2938
// Cow.
3039
// - Create utilities for slicing and manipulating easier than Cow.

0 commit comments

Comments
 (0)