@@ -8,6 +8,24 @@ import (
8
8
9
9
"alda.io/client/json"
10
10
log "alda.io/client/logging"
11
+
12
+ // FIXME: This doesn't work because the `parser` package depends on the
13
+ // `model` package, so attempting to import the `parser` package _from_ the
14
+ // `model` package results in a cyclic import error:
15
+ //
16
+ // package alda.io/client
17
+ // imports alda.io/client/cmd
18
+ // imports alda.io/client/code-generator
19
+ // imports alda.io/client/model
20
+ // imports alda.io/client/parser
21
+ // imports alda.io/client/model: import cycle not allowed
22
+ // package alda.io/client
23
+ // imports alda.io/client/cmd
24
+ // imports alda.io/client/code-generator
25
+ // imports alda.io/client/model
26
+ // imports alda.io/client/parser
27
+ // imports alda.io/client/model: import cycle not allowed
28
+ "alda.io/client/parser"
11
29
)
12
30
13
31
// Alda includes a minimal Lisp implementation as a subset of the language, in
@@ -1005,7 +1023,7 @@ func init() {
1005
1023
for marking := range DynamicVolumes {
1006
1024
defattribute ([]string {marking },
1007
1025
attributeFunctionSignature {
1008
- argumentTypes : []LispForm {},
1026
+ argumentTypes : []LispForm {},
1009
1027
implementation : dynamicImplementation (marking ),
1010
1028
},
1011
1029
)
@@ -1315,6 +1333,27 @@ func init() {
1315
1333
},
1316
1334
},
1317
1335
)
1336
+
1337
+ defn ("alda-code" ,
1338
+ FunctionSignature {
1339
+ ArgumentTypes : []LispForm {LispString {}},
1340
+ Implementation : func (args ... LispForm ) (LispForm , error ) {
1341
+ stringLiteral := args [0 ].(LispString )
1342
+
1343
+ // FIXME: This doesn't work because of a cyclic import error. See
1344
+ // comment at the top of this file for more details.
1345
+ scoreUpdates , err := parser .ParseString (stringLiteral .Value )
1346
+ if err != nil {
1347
+ return nil , & AldaSourceError {
1348
+ Context : stringLiteral .SourceContext ,
1349
+ Err : err ,
1350
+ }
1351
+ }
1352
+
1353
+ return EventSequence {Events : scoreUpdates }, nil
1354
+ },
1355
+ },
1356
+ )
1318
1357
}
1319
1358
1320
1359
// LispNil is the value nil.
0 commit comments