Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
380cf9c
feat(pir): print a plan's source as the statement's own lines
thiremani Nov 23, 2026
a3d5aaf
fix(pir): let no two statements render alike
thiremani Nov 23, 2026
b0fbf45
docs(pir): say a plan's source is the ast's spelling
thiremani Nov 23, 2026
18eabfa
docs(pir): claim only what the escaping rules give
thiremani Nov 23, 2026
64058e0
feat(parser): record the source a statement is spelled with
thiremani Nov 23, 2026
3b73aef
feat(pir): quote a plan's source from the file
thiremani Nov 23, 2026
74c3522
fix(lexer): leave a string's own characters alone when quoting a stat…
thiremani Nov 23, 2026
1f7eb9a
fix(lexer): measure a span's indentation after cutting its comments
thiremani Nov 23, 2026
4600507
refactor(pir): take a plan's source from the file and nowhere else
thiremani Nov 23, 2026
bca0ec9
docs(ast): say a caller that builds a statement spells it too
thiremani Nov 23, 2026
8000a3d
feat(token): give every token the runes that spell it
thiremani Nov 23, 2026
cf72f5b
refactor(lexer): quote a statement from its tokens, not from whole lines
thiremani Nov 23, 2026
20afc33
fix(lexer): start a shift where its spelling does, and move a span as…
thiremani Nov 24, 2026
9b24ccf
fix(lexer): read past a tab when a line holds nothing of the statement
thiremani Nov 24, 2026
700cae1
refactor(parser): let parseStatement own a statement's capture
thiremani Nov 24, 2026
82ad719
test(parser): ask the capture buffer what it still holds
thiremani Nov 24, 2026
71f4dca
refactor(lexer): state Spelling's span as a precondition
thiremani Nov 24, 2026
7df4812
fix(parser): take both ends of a span from what a source spells
thiremani Nov 24, 2026
d7200ec
refactor(lexer): keep a line's offsets inside the pass that needs them
thiremani Nov 24, 2026
e249d67
docs(lexer): name a line's bits after the question they answer
thiremani Nov 24, 2026
8ac6b95
docs(lexer): finish the sentence a rename left half-swapped
thiremani Nov 24, 2026
997da93
refactor(lexer): take a statement's first line whole
thiremani Nov 24, 2026
c4be762
feat(lexer)!: indent a block literal's rows by 4 spaces
thiremani Nov 25, 2026
a0b7d93
refactor(lexer): take a statement's indent off its later lines
thiremani Nov 25, 2026
0455967
fix(lexer,parser): judge a block literal's row depth in the parser
thiremani Nov 25, 2026
f2cc31a
refactor(parser): give a split operator's pieces their plain lengths
thiremani Nov 25, 2026
5feaade
test(parser): pin the lengths a split operator's first split gives
thiremani Nov 25, 2026
f980ba1
refactor(parser): remove the infix operator split that never ran
thiremani Nov 26, 2026
6bf6693
feat(parser)!: report an operator run that names no operator
thiremani Nov 26, 2026
40f6b12
fix(parser): end a failed cell where its brackets close
thiremani Nov 26, 2026
f13f523
refactor(parser): drop spell's test for a statement that failed
thiremani Nov 26, 2026
ba9f7bf
fix(parser): quote source only for completed statements
codex Nov 26, 2026
b733155
perf(parser): split a prefix operator run in linear time
codex Nov 26, 2026
7597f31
fix(parser): diagnose an undefined run after a positional value
codex Nov 26, 2026
e82680a
docs(parser): distinguish a named prefix operator from a run
codex Nov 26, 2026
0976ecb
test(parser): pin that a list item after a comma takes no condition
thiremani Nov 26, 2026
52e7a1f
test(parser): pin that a single prefix operator is not queued again
thiremani Nov 26, 2026
126f725
fix(parser): end a row at its own ']' when a cell fails on it
thiremani Nov 26, 2026
6d774de
feat(lexer,parser): end a statement's source at its line break
thiremani Nov 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ string literal produces a newline in the string's value -- the `\r` escape
denotes a literal carriage return -- so runtime behavior does not depend on
how git checks out line endings.

Indentation is significant. A block, such as a template's body or a struct
definition, is indented 4 spaces past the line that opens it, while the rows
of an array literal line up at any depth past it. Tabs are not allowed in
Indentation is significant. A block, such as a template's body, a struct
definition or an array literal's rows, is indented 4 spaces past the line
that opens it. Tabs are not allowed in
indentation. A struct's or table's header is written `: name ...`, its `:` 2
spaces left of the values and one space after it, so its names line up with
the values. Brackets don't join lines: a line that
Expand Down Expand Up @@ -298,7 +298,7 @@ where `[` is followed by a newline, contributes row and column axes even when
it contains one row. Thus the matrix above is equivalent to
`[[1 2] [3 4]]`. Pluto has no line continuation character: an inline array
has one row, however long, and a literal whose `[` ends its
line is a block, with its rows lined up at any depth past the line that
line is a block, with its rows 4 spaces past the line that
holds the `[`, and `]` on its own line at that line's column, however many
lines the statement spans. Array-valued cells stack
recursively
Expand Down
2 changes: 2 additions & 0 deletions ast/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ type LetStatement struct {
Name []*Identifier
Value []Expression
Condition []Expression
Src string // the source the file spells it with; a plan requires one, so a caller that builds a statement sets it too
}

func (ls *LetStatement) statementNode() {}
Expand Down Expand Up @@ -175,6 +176,7 @@ func (ls *LetStatement) String() string {
type PrintStatement struct {
Token token.Token // the first token of the expression
Expression *CallExpression
Src string // the source the file spells it with; a plan requires one, so a caller that builds a statement sets it too
}

func (ps *PrintStatement) statementNode() {}
Expand Down
4 changes: 2 additions & 2 deletions compiler/pir.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ func (c *Compiler) buildLetPlan(stmt *ast.LetStatement, fn string) *pir.AssignPl
nameParts[i] = ident.Value
}
plan := &pir.AssignPlan{
Head: pir.Head{Label: "assign " + strings.Join(nameParts, ", "), Func: fn, Source: stmt.String()},
Head: pir.Head{Label: "assign " + strings.Join(nameParts, ", "), Func: fn, Source: stmt.Src},
Commit: make([]pir.Mapping, 0, len(stmt.Name)),
}

Expand Down Expand Up @@ -529,7 +529,7 @@ func (c *Compiler) mapNextTarget(plan *pir.AssignPlan, stmt *ast.LetStatement, o
// string literal as itself, since print formats it in place, and any other
// argument as the outcome of its eval.
func (c *Compiler) buildPrintPlan(stmt *ast.PrintStatement, fn string) *pir.PrintPlan {
plan := &pir.PrintPlan{Head: pir.Head{Label: "print", Func: fn, Source: stmt.String()}}
plan := &pir.PrintPlan{Head: pir.Head{Label: "print", Func: fn, Source: stmt.Src}}
for _, expr := range stmt.Expression.Arguments {
if lit, isLit := expr.(*ast.StringLiteral); isLit {
plan.Args = append(plan.Args, pir.PrintArg{Literal: lit})
Expand Down
Loading
Loading