@quenk/wml 2.11.2 → 2.12.0

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/lib/parse/wml.y CHANGED
@@ -100,6 +100,7 @@ Text ({DoubleStringCharacter}*)|({SingleStringCharacter}*)
100
100
  <CONTROL>'false' return 'FALSE';
101
101
  <CONTROL>'where' return 'WHERE';
102
102
  <CONTROL>'let' return 'LET';
103
+ <CONTROL>'to' return 'TO';
103
104
  <CONTROL>{Constructor} return 'CONSTRUCTOR';
104
105
  <CONTROL>{Identifier} return 'IDENTIFIER';
105
106
  <CONTROL>'@' return '@';
@@ -372,15 +373,18 @@ view_statement
372
373
  ;
373
374
 
374
375
  view_statement_context
375
- : type
376
+ : constructor_type
376
377
  { $$ = $1; }
377
378
 
378
- | unqualified_constructor FROM string_literal
379
- {$$ = new yy.ast.ImportStatement(new yy.ast.CompositeMember([$1],@$),
380
- $3, @$);
381
- }
379
+ | context_from_statement
380
+ {$$ = $1; }
382
381
  ;
383
382
 
383
+ context_from_statement
384
+ : constructor_type FROM string_literal
385
+ {$$ = new yy.ast.ContextFromStatement($1, $3, @$); }
386
+ ;
387
+
384
388
  view_directives
385
389
  : let_statement
386
390
  { $$ = [$1]; }
@@ -464,11 +468,11 @@ non_function_type
464
468
  ;
465
469
 
466
470
  constructor_type
467
- : cons
471
+ : unqualified_constructor
468
472
  { $$ = new yy.ast.ConstructorType($1, [], @$); }
469
473
 
470
- | cons type_parameters
471
- { $$ = new yy.ast.ConstructorType($1, $2, @$); }
474
+ | unqualified_constructor type_parameters
475
+ { $$ = new yy.ast.ConstructorType($1, $2, @$); }
472
476
  ;
473
477
 
474
478
  record_type
@@ -481,11 +485,11 @@ record_type
481
485
  ;
482
486
 
483
487
  list_type
484
- : cons '[' ']'
488
+ : unqualified_constructor '[' ']'
485
489
  { $$ = new yy.ast.ListType(
486
490
  new yy.ast.ConstructorType($1, []), @$); }
487
491
 
488
- | cons type_parameters '[' ']'
492
+ | unqualified_constructor type_parameters '[' ']'
489
493
  { $$ = new yy.ast.ListType(
490
494
  new yy.ast.ConstructorType($1, $2), @$); }
491
495
 
@@ -680,6 +684,9 @@ for_statement
680
684
 
681
685
  | for_of
682
686
  {$$ = $1;}
687
+
688
+ | for_from
689
+ {$$ + $1;}
683
690
  ;
684
691
 
685
692
  for_in
@@ -702,20 +709,32 @@ for_of
702
709
  {$$ = new yy.ast.ForOfStatement($3, $5, $7, $11, @$);}
703
710
  ;
704
711
 
712
+ for_from
713
+ : '{%' FOR untyped_parameter '=' expression TO expression '%}'
714
+ children
715
+ '{%' ENDFOR '%}'
716
+ {$$ = new yy.ast.ForFromStatement($3, $5, $7, $9, [], @$);}
717
+ ;
718
+
705
719
  for_parameters
706
- : parameter
720
+ : for_parameter
707
721
  {$$ = [$1]; }
708
722
 
709
- | untyped_parameter
710
- { $$ = [$1]; }
711
-
712
723
  | for_parameters ',' parameter
713
724
  {$$ = $1.concat($3); }
714
725
 
715
726
  | for_parameters ',' untyped_parameter
716
727
  {$$ = $1.concat($3); }
717
728
  ;
718
-
729
+
730
+ for_parameter
731
+ : parameter
732
+ {$$ = $1; }
733
+
734
+ | untyped_parameter
735
+ { $$ = $1; }
736
+ ;
737
+
719
738
  if_statement
720
739
  : '{%' IF expression '%}' children '{%' ENDIF '%}'
721
740
  {$$ = new yy.ast.IfStatement($3, $5, undefined, @$); }
@@ -818,8 +837,8 @@ simple_expression
818
837
  |member_expression
819
838
  |literal
820
839
  |context_property
821
- |cons
822
- |identifier
840
+ |unqualified_constructor
841
+ |unqualified_identifier
823
842
  |context_variable)
824
843
  { $$ = $1; }
825
844
  ;
@@ -846,24 +865,24 @@ type_arg_list
846
865
  ;
847
866
 
848
867
  construct_expression
849
- : cons '(' arguments ')'
868
+ : unqualified_constructor '(' arguments ')'
850
869
  { $$ = new yy.ast.ConstructExpression($1, $3, @$); }
851
870
 
852
- | cons '(' ')'
871
+ | unqualified_constructor '(' ')'
853
872
  { $$ = new yy.ast.ConstructExpression($1, [], @$); }
854
873
  ;
855
874
 
856
875
  call_expression
857
- : identifier type_arguments '(' arguments ')'
876
+ : unqualified_identifier type_arguments '(' arguments ')'
858
877
  {$$ = new yy.ast.CallExpression($1, $2, $4, @$); }
859
878
 
860
- | identifier type_arguments '(' ')'
879
+ | unqualified_identifier type_arguments '(' ')'
861
880
  {$$ = new yy.ast.CallExpression($1, $2, [], @$); }
862
881
 
863
- | identifier '(' arguments ')'
882
+ | unqualified_identifier '(' arguments ')'
864
883
  {$$ = new yy.ast.CallExpression($1, [], $3, @$); }
865
884
 
866
- | identifier '(' ')'
885
+ | unqualified_identifier '(' ')'
867
886
  {$$ = new yy.ast.CallExpression($1, [], [], @$); }
868
887
 
869
888
  | context_property type_arguments '(' arguments ')'
@@ -910,43 +929,34 @@ call_expression
910
929
  ;
911
930
 
912
931
  member_expression
913
-
914
- : qualified_identifier '.' unqualified_identifier
932
+ : member_expression_head '.' member_expression_tail
915
933
  {$$ = new yy.ast.MemberExpression($1, $3, @$); }
916
934
 
917
- | qualified_constructor '.' unqualified_identifier
935
+ | member_expression '.' member_expression_tail
918
936
  {$$ = new yy.ast.MemberExpression($1, $3, @$); }
919
937
 
920
- | context_variable '.' unqualified_identifier
921
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
922
-
923
- | context_property '.' unqualified_identifier
924
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
925
-
926
- | list '.' unqualified_identifier
927
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
928
-
929
- | record '.' unqualified_identifier
930
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
931
-
932
- | string_literal '.' unqualified_identifier
933
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
934
-
935
- | call_expression '.' unqualified_identifier
938
+ | member_expression '[' string_literal ']'
936
939
  {$$ = new yy.ast.MemberExpression($1, $3, @$); }
940
+ ;
937
941
 
938
- |'(' expression ')' '.' unqualified_identifier
939
- {$$ = new yy.ast.MemberExpression($2, $5, @$); }
940
-
941
- | member_expression '.' unqualified_identifier
942
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
942
+ member_expression_head:
943
+ ( unqualified_identifier
944
+ | unqualified_constructor
945
+ | context_variable
946
+ | context_property
947
+ | list
948
+ | record
949
+ | string_literal
950
+ | call_expression
951
+ |'(' expression ')'
952
+ )
953
+ ;
943
954
 
944
- | member_expression '[' string_literal ']'
945
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
955
+ member_expression_tail
956
+ : (unqualified_identifier| unqualified_constructor|string_literal)
946
957
  ;
947
958
 
948
959
  function_expression
949
-
950
960
  : parameters '->' expression
951
961
  {$$ = new yy.ast.FunctionExpression($1, $3, @$); }
952
962
 
package/lib/tsconfig.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "baseUrl": "src",
4
4
  "lib": ["es5", "ES2015", "DOM"],
5
5
  "module": "commonjs",
6
- "target": "es5",
6
+ "target": "es6",
7
7
  "rootDir": ".",
8
8
  "moduleResolution": "node",
9
9
  "allowUnreachableCode": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenk/wml",
3
- "version": "2.11.2",
3
+ "version": "2.12.0",
4
4
  "description": "(WML) is a DSL for describing user interfaces in web applications.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -23,7 +23,6 @@
23
23
  "jison-gho": "^0.6.1-216",
24
24
  "mocha": "^9.0.0",
25
25
  "ts-node": "^10.5.0",
26
- "typedoc": "^0.20.36",
27
26
  "typescript": "^4.3.2"
28
27
  },
29
28
  "dependencies": {