@liquidmetal-ai/drizzle 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @liquidmetal-ai/drizzle
2
2
 
3
+ ## 0.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 03a946d: Updates for smartbucket querying
8
+
3
9
  ## 0.3.1
4
10
 
5
11
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  const TOKEN_PATTERNS = [
2
2
  { type: 'number', pattern: /^\d+(\.\d+)?/ },
3
- { type: 'comment', pattern: /^\/\/[^\n]*/ },
3
+ { type: 'comment', pattern: /^(\/\/|#)[^\n]*/ },
4
4
  { type: 'operator', pattern: /^[+\-*/%=]/ },
5
5
  { type: 'whitespace', pattern: /^[ \t]+/ },
6
6
  { type: 'boolean', pattern: /^(true|false)/ },
@@ -463,3 +463,56 @@ application "my-app" {
463
463
  ],
464
464
  });
465
465
  });
466
+ test('parse hash comments', () => {
467
+ const tokenizer = new Tokenizer(`
468
+ application "my-app" {
469
+ service "my-service" {
470
+ # This is a hash comment
471
+ domain {
472
+ fqdn = "example.com"
473
+ }
474
+
475
+ binding {
476
+ foo = "bar" # this is an inline hash comment
477
+ }
478
+
479
+ # Comment with leading spaces
480
+ env "API_KEY" {
481
+ secret = true
482
+ }
483
+ }
484
+ }
485
+ `);
486
+ const parser = new Parser(tokenizer);
487
+ const translator = new JSONTranslator();
488
+ const ast = parser.parse();
489
+ expect(parser.errors).toEqual([]);
490
+ expect(translator.translate(ast)).toEqual({
491
+ application: [
492
+ {
493
+ name: 'my-app',
494
+ service: [
495
+ {
496
+ name: 'my-service',
497
+ domain: [
498
+ {
499
+ fqdn: 'example.com',
500
+ },
501
+ ],
502
+ binding: [
503
+ {
504
+ foo: 'bar',
505
+ },
506
+ ],
507
+ env: [
508
+ {
509
+ name: 'API_KEY',
510
+ secret: true,
511
+ },
512
+ ],
513
+ },
514
+ ],
515
+ },
516
+ ],
517
+ });
518
+ });