Data File Grammar
The grammar for OPL data files
0 $accept: CompilationUnit $end
1 CompilationUnit: /* empty */
2 | Prepare_opt Elements
3 Elements: Element Invoke_opt ';'
4 | Elements Element Invoke_opt ';'
5 | error ';'
6 @1: /* empty */
7 Element: Id @1 '=' Item
8 | Connection
9 | Read
10 | Publish
11 String: "(string-literal)"
12 | Id
13 Id: "(identifier)"
14 IdOrPath: "(identifier path)"
15 | Id
16 IdOrPathList: IdOrPath IdOrPath
17 | IdOrPathList IdOrPath
18 Connection: "DBConnection" Id '(' String String ')'
19 | "SheetConnection" Id '(' String ')'
20 | CustomConnection Id '(' String String ')'
21 Read: IdOrPath "from" "DBRead" '(' Id String ')' PlaceHolders_opt
22 | IdOrPathList "from" "DBRead" '(' Id String ')' PlaceHolders_opt
23 | IdOrPath "from" "SheetRead" '(' Id String ')'
24 | IdOrPath "from" CustomRead '(' Id String ')'
25 PlaceHolders_opt: /* empty */
26 | '(' PlaceHolders ')'
27 PlaceHolders: PlaceHolder
28 | PlaceHolders PlaceHolder
29 PlaceHolder: Id
30 Publish: "DBExecute" '(' Id String ')'
31 | IdOrPath "to" "DBUpdate" '(' Id String ')'
32 | IdOrPath "to" "SheetWrite" '(' Id String ')'
33 | IdOrPath "to" CustomPublish '(' Id String ')'
34 CustomConnection: "*Connection"
35 CustomRead: "*Read"
36 CustomPublish: "*Publish"
37 Items: Item
38 | Items Item
39 Items_opt: /* empty */
40 | Items
41 Item: Primitive
42 | Array
43 | Tuple
44 | Set
45 Primitive: "(int-literal)"
46 | "(float-literal)"
47 | "(string-literal)"
48 | "(identifier)"
49 @2: /* empty */
50 Array: "[" @2 Items_opt "]"
51 @3: /* empty */
52 Array: "#[" @3 IndexedItems "]#"
53 | error "]"
54 | error "]#"
55 IndexedItems: IndexedItem
56 | IndexedItems IndexedItem
57 IndexedItem: Index ':' Item
58 Index: "(int-literal)"
59 | "(float-literal)"
60 | "(string-literal)"
61 | Id
62 | IndexTuple
63 @4: /* empty */
64 IndexTuple: "<" @4 Items ">"
65 | error ">"
66 @5: /* empty */
67 Tuple: "<" @5 Items ">"
68 @6: /* empty */
69 Tuple: "#<" @6 NamedItems ">#"
70 | error ">"
71 | error ">#"
72 NamedItems: NamedItem
73 | NamedItems NamedItem
74 NamedItem: Name ':' Item
75 Name: Id
76 @7: /* empty */
77 Set: "{" @7 Items_opt "}"
78 | error "}"
79 Prepare_opt: /* empty */
80 | Prepare
81 Prepare: "prepare" "(execute-block)"
82 Invoke_opt: /* empty */
83 | Invoke
84 Invoke: "invoke" Id