rbelly 2.0.3 → 2.1.1

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.
data/lib/parser.y CHANGED
@@ -11,7 +11,7 @@ token FINALLY FOR FUNCTION IF IN INSTANCEOF NEW RETURN SWITCH THIS THROW TRY
11
11
  token TYPEOF VAR VOID WHILE WITH
12
12
 
13
13
  /* Bellejs Keywords */
14
- token IMPORT CLASS
14
+ token IMPORT CLASS EXTENDS PUBLIC PRIVATE
15
15
 
16
16
  /* punctuators */
17
17
  token EQEQ NE /* == and != */
@@ -64,6 +64,8 @@ rule
64
64
  Statement:
65
65
  Block
66
66
  | VariableStatement
67
+ | BellejsVariableStatement
68
+ | BellejsFunctionStatement
67
69
  | ConstStatement
68
70
  | EmptyStatement
69
71
  | ExprStatement
@@ -79,6 +81,7 @@ rule
79
81
  | TryStatement
80
82
  | DebuggerStatement
81
83
  | ImportStatement
84
+ | ExtendsStatement
82
85
  ;
83
86
 
84
87
  Literal:
@@ -525,6 +528,17 @@ rule
525
528
  }
526
529
  ;
527
530
 
531
+ BellejsFunctionStatement:
532
+ PUBLIC VariableStatement {
533
+ result = BellejsVarStatementNode.new(val[0], val[1])
534
+ debug(result)
535
+ }
536
+ | PRIVATE VariableStatement {
537
+ result = BellejsVarStatementNode.new(val[0], val[1])
538
+ debug(result)
539
+ }
540
+ ;
541
+
528
542
  VariableStatement:
529
543
  VAR VariableDeclarationList ';' {
530
544
  result = VarStatementNode.new(val[1])
@@ -828,6 +842,21 @@ rule
828
842
  result = ClassNode.new(val[1], val[3])
829
843
  debug(val[3])
830
844
  }
845
+ | CLASS IDENT ExtendsStatement '{' ClassBody '}' {
846
+ result = ClassNode.new(val[1], val[4], val[2])
847
+ debug(val[3])
848
+ }
849
+
850
+ BellejsVariableStatement:
851
+ PUBLIC FunctionDeclaration {
852
+ result = BellejsFuncStatementNode.new(val[0], val[1])
853
+ debug(result)
854
+ }
855
+ | PRIVATE FunctionDeclaration {
856
+ result = BellejsFuncStatementNode.new(val[0], val[1])
857
+ debug(result)
858
+ }
859
+ ;
831
860
 
832
861
  FunctionDeclaration:
833
862
  FUNCTION IDENT '(' ')' '{' FunctionBody '}' {
@@ -870,6 +899,10 @@ rule
870
899
  SourceElements { result = ClassBodyNode.new(val[0]) }
871
900
  ;
872
901
 
902
+ ExtendsStatement:
903
+ EXTENDS IDENT { result = ExtendsNode.new(val[1]) }
904
+ ;
905
+
873
906
  FunctionBody:
874
907
  SourceElements { result = FunctionBodyNode.new(val[0]) }
875
908
  ;
@@ -1,3 +1,3 @@
1
1
  module RBelly
2
- VERSION = '1.0.7'
2
+ VERSION = '2.1.0'
3
3
  end