tallakt-plcutil 0.2.6 → 0.2.7

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.
@@ -12,6 +12,9 @@ module PlcUtil
12
12
  rule db
13
13
  'DATA_BLOCK ' name eol
14
14
  title
15
+ author?
16
+ family?
17
+ block_name?
15
18
  'VERSION : ' version eol
16
19
  eol*
17
20
  root_struct_decl
@@ -23,6 +26,9 @@ module PlcUtil
23
26
 
24
27
  rule udt
25
28
  'TYPE ' name eol
29
+ author?
30
+ family?
31
+ block_name?
26
32
  'VERSION : ' version eol
27
33
  eol*
28
34
  root_struct_decl
@@ -33,6 +39,9 @@ module PlcUtil
33
39
  rule ob
34
40
  'ORGANIZATION_BLOCK ' name eol
35
41
  title
42
+ author?
43
+ family?
44
+ block_name?
36
45
  'VERSION : ' version eol
37
46
  eol*
38
47
  (!ob_end .)*
@@ -68,6 +77,18 @@ module PlcUtil
68
77
  'TITLE =' optional_title:(ws title_quoted:(quoted_string))? eol
69
78
  end
70
79
 
80
+ rule author
81
+ 'AUTHOR : ' (!eol .)* eol
82
+ end
83
+
84
+ rule family
85
+ 'FAMILY : ' (!eol .)* eol
86
+ end
87
+
88
+ rule block_name
89
+ 'NAME : ' (!eol .)* eol
90
+ end
91
+
71
92
  rule ob_end
72
93
  'END_ORGANIZATION_BLOCK'
73
94
  end
@@ -93,7 +114,7 @@ module PlcUtil
93
114
  end
94
115
 
95
116
  rule initial_value
96
- ':=' ws single_quoted_string
117
+ ':=' ws (single_quoted_string / float)
97
118
  end
98
119
 
99
120
  rule array_declaration
@@ -110,7 +131,7 @@ module PlcUtil
110
131
  end
111
132
 
112
133
  rule struct_data_type
113
- 'STRUCT' ws? eol
134
+ 'STRUCT' ws? struct_comment:(line_comment?) eol
114
135
  decl:declaration*
115
136
  ws 'END_STRUCT'
116
137
  end
@@ -152,6 +173,10 @@ module PlcUtil
152
173
  (single_quoted_string / (!(ws / ';') .)+)
153
174
  end
154
175
 
176
+ rule float
177
+ [0-9]+ "." [0-9]+ "e+" [0-9]+
178
+ end
179
+
155
180
  rule eol
156
181
  "\r"? "\n"
157
182
  end
@@ -16,7 +16,7 @@ module PlcUtil
16
16
  attr_reader :symlist
17
17
 
18
18
  def initialize(filename, options = {})
19
- @symlist = options[:symlist] && SymlistFile.new(options[:symlist])
19
+ @symlist = options[:symlist] && SymlistFile.new(options[:symlist]) || {}
20
20
  # parse file
21
21
  parser = PlcUtil::Awl::AwlGrammarParser.new
22
22
  awl_nodes = parser.parse File.read(filename)
@@ -24,7 +24,7 @@ module PlcUtil
24
24
  if !@awl
25
25
  raise [
26
26
  "Unable to parse file: #{filename}",
27
- "Failure on line #{parser.failure_line} column #{parser.failure.column}",
27
+ "Failure on line #{parser.failure_line} column #{parser.failure_column}",
28
28
  "Details:",
29
29
  parser.failure_reason.inspect,
30
30
  ].join("\n")
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.6'
6
+ VERSION = '0.2.7'
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.6
4
+ version: 0.2.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: