v1.4.0 release: live-coding scratch editor, interpreted Graph DSL, ClosureSynthesizer + SampleLoop
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// DSLToken.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// A lexed token: a kind, the source text it covers, and its span.
|
||||
|
||||
/// One token produced by ``DSLLexer``.
|
||||
public struct DSLToken: Equatable, Sendable {
|
||||
|
||||
/// The lexical categories the DSL recognises.
|
||||
public enum Kind: Equatable, Sendable {
|
||||
case identifier
|
||||
case number
|
||||
case leftParen
|
||||
case rightParen
|
||||
case comma
|
||||
case colon
|
||||
case dot
|
||||
case equals
|
||||
case plus
|
||||
case minus
|
||||
case star
|
||||
case slash
|
||||
/// A statement separator (one or more newlines collapsed).
|
||||
case newline
|
||||
/// End of input.
|
||||
case eof
|
||||
}
|
||||
|
||||
public let kind: Kind
|
||||
/// The exact source text (identifier name, number literal, …). Empty for
|
||||
/// punctuation / newline / eof.
|
||||
public let text: String
|
||||
public let span: DSLSpan
|
||||
|
||||
public init(kind: Kind, text: String, span: DSLSpan) {
|
||||
self.kind = kind
|
||||
self.text = text
|
||||
self.span = span
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user