tallakt-plcutil 0.2.11 → 0.2.12

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.
@@ -10,20 +10,20 @@ module PlcUtil
10
10
  end
11
11
 
12
12
  rule db
13
- 'DATA_BLOCK ' name eol
14
- title
15
- author?
16
- family?
17
- block_name?
18
- 'VERSION : ' version eol
19
- eol*
13
+ 'DATA_BLOCK' ws name eol
14
+ (title / author / family / block_name / eol / ws_comments / ('VERSION : ' version eol))*
20
15
  root_struct_decl
16
+ ws_comments*
21
17
  'BEGIN' eol
22
- assignment*
18
+ (ws_comments / assignment)*
23
19
  'END_DATA_BLOCK' eol
24
20
  ws_eol
25
21
  end
26
22
 
23
+ rule ws_comments
24
+ (ws? line_comment? eol)
25
+ end
26
+
27
27
  rule udt
28
28
  'TYPE ' name eol
29
29
  author?
@@ -66,7 +66,7 @@ module PlcUtil
66
66
  end
67
67
 
68
68
  rule db_name
69
- 'DB ' number:([0-9]+)
69
+ 'DB' ' '? number:([0-9]+)
70
70
  end
71
71
 
72
72
  rule version
@@ -98,11 +98,12 @@ module PlcUtil
98
98
  end
99
99
 
100
100
  rule declaration
101
+ eol*
101
102
  ws
102
103
  identifier
103
- ' : '
104
+ ws ':' ws
104
105
  d:(array_declaration <ArrayDeclarationNode> / nonarray_declaration <NonArrayDeclarationNode>)
105
- eol
106
+ eol+
106
107
  end
107
108
 
108
109
  rule nonarray_declaration
@@ -133,11 +134,11 @@ module PlcUtil
133
134
  rule struct_data_type
134
135
  'STRUCT' ws? struct_comment:(line_comment?) eol
135
136
  decl:declaration*
136
- ws 'END_STRUCT'
137
+ ws? 'END_STRUCT'
137
138
  end
138
139
 
139
140
  rule root_struct_decl
140
- ws struct_data_type ws ';' ws? eol
141
+ ws? struct_data_type ws? ';' ws? eol
141
142
  end
142
143
 
143
144
  rule udt_data_type
@@ -153,20 +154,55 @@ module PlcUtil
153
154
  end
154
155
 
155
156
  rule basic_data_type
156
- (
157
- 'INT' /
158
- 'DINT' /
159
- 'BOOL' /
160
- 'BYTE' /
161
- 'WORD' /
162
- 'DWORD' /
163
- 'TIME_OF_DAY' /
164
- 'REAL' /
165
- 'TIME' /
166
- 'S5TIME' /
167
- 'DATE' /
168
- 'CHAR'
169
- )
157
+ ( int / dint / bool / byte / word / dword / time_of_day / real / time / s5time / date / char )
158
+ end
159
+
160
+ rule int
161
+ [Ii] [Nn] [Tt]
162
+ end
163
+
164
+ rule dint
165
+ [Dd] [Ii] [Nn] [Tt]
166
+ end
167
+
168
+ rule bool
169
+ [Bb] [Oo] [Oo] [Ll]
170
+ end
171
+
172
+ rule byte
173
+ [Bb] [Yy] [Tt] [Ee]
174
+ end
175
+
176
+ rule word
177
+ [Ww] [Oo] [Rr] [Dd]
178
+ end
179
+
180
+ rule dword
181
+ [Dd] [Ww] [Oo] [Rr] [Dd]
182
+ end
183
+
184
+ rule time_of_day
185
+ [Tt] [Ii] [Mm] [Ee] [_] [Oo] [Ff] [_] [Dd] [Aa] [Yy]
186
+ end
187
+
188
+ rule real
189
+ [Rr] [Ee] [Aa] [Ll]
190
+ end
191
+
192
+ rule time
193
+ [Tt] [Ii] [Mm] [Ee]
194
+ end
195
+
196
+ rule s5time
197
+ [Ss] '5' [Tt] [Ii] [Mm] [Ee]
198
+ end
199
+
200
+ rule date
201
+ [Dd] [Aa] [Tt] [Ee]
202
+ end
203
+
204
+ rule char
205
+ [Cc] [Hh] [Aa] [Rr]
170
206
  end
171
207
 
172
208
  rule value
data/lib/plcutil.rb CHANGED
@@ -3,6 +3,6 @@ $:.unshift(File.dirname(__FILE__)) unless
3
3
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
4
4
 
5
5
  module PlcUtil
6
- VERSION = '0.2.11'
6
+ VERSION = '0.2.12'
7
7
  end
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tallakt-plcutil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  version: '0'
140
140
  requirements: []
141
141
  rubyforge_project:
142
- rubygems_version: 1.8.23
142
+ rubygems_version: 1.8.24
143
143
  signing_key:
144
144
  specification_version: 3
145
145
  summary: Ruby PLC file library
@@ -147,3 +147,4 @@ test_files:
147
147
  - test/input_files/step7_v5.4/00000001.AWL
148
148
  - test/input_files/step7_v5.4/S7_pro2.zip
149
149
  - test/input_files/step7_v5.4/SYMLIST.DBF
150
+ has_rdoc: