@quenk/wml 2.11.4 → 2.13.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
@@ -459,7 +459,7 @@ non_function_type
459
459
 
460
460
  | record_type
461
461
  { $$ = $1; }
462
-
462
+
463
463
  | list_type
464
464
  { $$ = $1; }
465
465
 
@@ -468,10 +468,16 @@ non_function_type
468
468
  ;
469
469
 
470
470
  constructor_type
471
- : cons
471
+ : unqualified_constructor
472
+ { $$ = new yy.ast.ConstructorType($1, [], @$); }
473
+
474
+ | unqualified_constructor type_parameters
475
+ { $$ = new yy.ast.ConstructorType($1, $2, @$); }
476
+
477
+ | qualified_constructor
472
478
  { $$ = new yy.ast.ConstructorType($1, [], @$); }
473
479
 
474
- | cons type_parameters
480
+ | qualified_constructor type_parameters
475
481
  { $$ = new yy.ast.ConstructorType($1, $2, @$); }
476
482
  ;
477
483
 
@@ -485,11 +491,11 @@ record_type
485
491
  ;
486
492
 
487
493
  list_type
488
- : cons '[' ']'
494
+ : unqualified_constructor '[' ']'
489
495
  { $$ = new yy.ast.ListType(
490
496
  new yy.ast.ConstructorType($1, []), @$); }
491
497
 
492
- | cons type_parameters '[' ']'
498
+ | unqualified_constructor type_parameters '[' ']'
493
499
  { $$ = new yy.ast.ListType(
494
500
  new yy.ast.ConstructorType($1, $2), @$); }
495
501
 
@@ -613,17 +619,21 @@ node
613
619
  ;
614
620
 
615
621
  widget
616
- : '<' cons attributes '>' children? '</' cons '>'
617
- {$$ = new yy.ast.Widget($2, $3, $5||[], $7, @$);}
622
+ : '<' widget_constructor attributes '>' children? '</' cons '>'
623
+ {$$ = new yy.ast.Widget($2[0], $2[1], $3, $5||[], $7, @$);}
618
624
 
619
- | '<' cons '>' children? '</' cons '>'
620
- {$$ = new yy.ast.Widget($2, [], $4||[], $6, @$);}
625
+ | '<' widget_constructor '>' children? '</' cons '>'
626
+ {$$ = new yy.ast.Widget($2[0], $2[1], [], $4||[], $6, @$);}
621
627
 
622
- | '<' cons attributes '/>'
623
- { $$ = new yy.ast.Widget($2, $3, [], $2, @$); }
628
+ | '<' widget_constructor attributes '/>'
629
+ { $$ = new yy.ast.Widget($2[0], $2[1], $3, [], $2, @$); }
630
+
631
+ | '<' widget_constructor '/>'
632
+ { $$ = new yy.ast.Widget($2[0], $2[1], [], [], $2, @$); }
633
+ ;
624
634
 
625
- | '<' cons '/>'
626
- { $$ = new yy.ast.Widget($2, [], [], $2, @$); }
635
+ widget_constructor
636
+ : cons type_arguments? {$$ = [$1, $2 || []]; }
627
637
  ;
628
638
 
629
639
  attributes
@@ -778,9 +788,6 @@ expression
778
788
  | unary_expression
779
789
  { $$ = $1; }
780
790
 
781
- | type_assertion
782
- { $$ = $1; }
783
-
784
791
  | simple_expression
785
792
  { $$ = $1; }
786
793
 
@@ -824,11 +831,6 @@ unary_expression
824
831
  {$$ = new yy.ast.UnaryExpression($4, $2, @$); }
825
832
  ;
826
833
 
827
- type_assertion
828
- : '[' '*' type ']' expression
829
- {$$ = new yy.ast.TypeAssertion($3, $5, @$); }
830
- ;
831
-
832
834
  simple_expression
833
835
  : (
834
836
  construct_expression
@@ -837,8 +839,8 @@ simple_expression
837
839
  |member_expression
838
840
  |literal
839
841
  |context_property
840
- |cons
841
- |identifier
842
+ |unqualified_constructor
843
+ |unqualified_identifier
842
844
  |context_variable)
843
845
  { $$ = $1; }
844
846
  ;
@@ -865,24 +867,30 @@ type_arg_list
865
867
  ;
866
868
 
867
869
  construct_expression
868
- : cons '(' arguments ')'
869
- { $$ = new yy.ast.ConstructExpression($1, $3, @$); }
870
+ : unqualified_constructor type_arguments '(' arguments ')'
871
+ { $$ = new yy.ast.ConstructExpression($1, $2, $4, @$); }
870
872
 
871
- | cons '(' ')'
872
- { $$ = new yy.ast.ConstructExpression($1, [], @$); }
873
+ | unqualified_constructor '(' arguments ')'
874
+ { $$ = new yy.ast.ConstructExpression($1, [], $3, @$); }
875
+
876
+ | unqualified_constructor type_arguments '(' ')'
877
+ { $$ = new yy.ast.ConstructExpression($1, $2, [], @$); }
878
+
879
+ | unqualified_constructor '(' ')'
880
+ { $$ = new yy.ast.ConstructExpression($1, [], [], @$); }
873
881
  ;
874
882
 
875
883
  call_expression
876
- : identifier type_arguments '(' arguments ')'
884
+ : unqualified_identifier type_arguments '(' arguments ')'
877
885
  {$$ = new yy.ast.CallExpression($1, $2, $4, @$); }
878
886
 
879
- | identifier type_arguments '(' ')'
887
+ | unqualified_identifier type_arguments '(' ')'
880
888
  {$$ = new yy.ast.CallExpression($1, $2, [], @$); }
881
889
 
882
- | identifier '(' arguments ')'
890
+ | unqualified_identifier '(' arguments ')'
883
891
  {$$ = new yy.ast.CallExpression($1, [], $3, @$); }
884
892
 
885
- | identifier '(' ')'
893
+ | unqualified_identifier '(' ')'
886
894
  {$$ = new yy.ast.CallExpression($1, [], [], @$); }
887
895
 
888
896
  | context_property type_arguments '(' arguments ')'
@@ -929,43 +937,34 @@ call_expression
929
937
  ;
930
938
 
931
939
  member_expression
932
-
933
- : qualified_identifier '.' unqualified_identifier
934
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
935
-
936
- | qualified_constructor '.' unqualified_identifier
937
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
938
-
939
- | context_variable '.' unqualified_identifier
940
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
941
-
942
- | context_property '.' unqualified_identifier
943
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
944
-
945
- | list '.' unqualified_identifier
946
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
947
-
948
- | record '.' unqualified_identifier
940
+ : member_expression_head '.' member_expression_tail
949
941
  {$$ = new yy.ast.MemberExpression($1, $3, @$); }
950
942
 
951
- | string_literal '.' unqualified_identifier
943
+ | member_expression '.' member_expression_tail
952
944
  {$$ = new yy.ast.MemberExpression($1, $3, @$); }
953
945
 
954
- | call_expression '.' unqualified_identifier
946
+ | member_expression '[' string_literal ']'
955
947
  {$$ = new yy.ast.MemberExpression($1, $3, @$); }
948
+ ;
956
949
 
957
- |'(' expression ')' '.' unqualified_identifier
958
- {$$ = new yy.ast.MemberExpression($2, $5, @$); }
959
-
960
- | member_expression '.' unqualified_identifier
961
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
950
+ member_expression_head:
951
+ ( unqualified_identifier
952
+ | unqualified_constructor
953
+ | context_variable
954
+ | context_property
955
+ | list
956
+ | record
957
+ | string_literal
958
+ | call_expression
959
+ |'(' expression ')'
960
+ )
961
+ ;
962
962
 
963
- | member_expression '[' string_literal ']'
964
- {$$ = new yy.ast.MemberExpression($1, $3, @$); }
963
+ member_expression_tail
964
+ : (unqualified_identifier| unqualified_constructor|string_literal)
965
965
  ;
966
966
 
967
967
  function_expression
968
-
969
968
  : parameters '->' expression
970
969
  {$$ = new yy.ast.FunctionExpression($1, $3, @$); }
971
970
 
@@ -1079,7 +1078,7 @@ unqualified_identifier
1079
1078
  ;
1080
1079
 
1081
1080
  binary_operator
1082
- : ('>'|'>='|'<'|'<='|'=='|'!='|'+'|'/'|'-'|'='|'&&'|'||'|'^'|INSTANCEOF)
1081
+ : ('>'|'>='|'<'|'<='|'=='|'!='|'+'|'/'|'-'|'='|'&&'|'||'|'^'|INSTANCEOF|AS)
1083
1082
  { $$ = $1; }
1084
1083
  ;
1085
1084
 
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.4",
3
+ "version": "2.13.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": {