summaryrefslogtreecommitdiff
path: root/src-2.9/GF/JavaScript/JS.cf
blob: fe31a20748eb52873521af7c2d4b9a9c36669d18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
entrypoints Program;

Program. Program ::= [Element];

FunDef.  Element ::= "function" Ident "(" [Ident] ")" "{" [Stmt] "}" ;
ElStmt.  Element ::= Stmt;
separator Element "" ;

separator Ident "," ;

SCompound.   Stmt ::= "{" [Stmt] "}" ;
SReturnVoid. Stmt ::= "return" ";" ;
SReturn.     Stmt ::= "return" Expr ";" ;
SDeclOrExpr. Stmt ::= DeclOrExpr ";" ;
separator Stmt "" ;

Decl.  DeclOrExpr ::= "var" [DeclVar];
DExpr. DeclOrExpr ::= Expr1 ;

DVar.  DeclVar ::= Ident ;
DInit. DeclVar ::= Ident "=" Expr ;
separator DeclVar "," ;

EAssign. Expr13 ::= Expr14 "=" Expr13 ;

ENew.    Expr14 ::= "new" Ident "(" [Expr] ")" ;

EMember. Expr15 ::= Expr15 "." Ident ;
EIndex.  Expr15 ::= Expr15 "[" Expr "]" ;
ECall.   Expr15 ::= Expr15 "(" [Expr] ")" ;

EVar.    Expr16 ::= Ident ;
EInt.    Expr16 ::= Integer ;
EDbl.    Expr16 ::= Double ;
EStr.    Expr16 ::= String ;
ETrue.   Expr16 ::= "true" ;
EFalse.  Expr16 ::= "false" ;
ENull.   Expr16 ::= "null" ;
EThis.   Expr16 ::= "this" ;
EFun.    Expr16 ::= "function" "(" [Ident] ")" "{" [Stmt] "}" ;
EArray.  Expr16 ::= "[" [Expr] "]" ;
EObj.    Expr16 ::= "{" [Property] "}" ;

eseq1.   Expr16  ::= "(" Expr "," [Expr] ")";
internal ESeq. Expr16 ::= "(" [Expr] ")" ;
define eseq1 x xs = ESeq (x:xs); 

separator Expr "," ;
coercions Expr 16 ;

Prop. Property ::= PropertyName ":" Expr ;
separator Property "," ;

IdentPropName.  PropertyName ::= Ident ;
StringPropName. PropertyName ::= String ;