automotive-ecu 0.3.4 → 0.3.6
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.
- checksums.yaml +4 -4
- data/lib/ecu/interfaces/dcm/dcm_lexer.rb +1 -1
- data/lib/ecu/interfaces/dcm/dcm_parser.rb +8 -0
- data/lib/ecu/interfaces/dcm/dcm_parser_error.rb +4 -3
- data/lib/ecu/interfaces/dcm/festwert.rb +2 -0
- data/lib/ecu/interfaces/dcm/festwerteblock.rb +2 -0
- data/lib/ecu/interfaces/dcm/kennfeld.rb +2 -0
- data/lib/ecu/interfaces/dcm/kennlinie.rb +2 -0
- data/lib/ecu/interfaces/dcm/label.rb +2 -0
- data/lib/ecu/interfaces/dcm/label_list.rb +4 -2
- data/lib/ecu/interfaces/dcm/stuetzstellenverteilung.rb +2 -0
- data/lib/ecu/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ab586bfaab8ab1d647a8f0f76cd247798baba7e10e207a9e03173a854fb13817
|
|
4
|
+
data.tar.gz: 39cf49dca991aa8966dd679914d9d88f05585e7b0a34fdff29a8783e2eae19d9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21a979a28ff42b637574725b54a0dc46ff5a4659f0a26bdb50ec0e6a81c0262a46d14891af2f09f8846a545f1decb6e2994c4de92dbf05b8f0171c6f946b27f5
|
|
7
|
+
data.tar.gz: 2f2026c2d122d4ecd2295ff941c4fb397fe5b20383ab927e731a80178733d69e86a23343429abf751c8beab39b8483bd8c35ce62049a3af0302436668a986d6d
|
|
@@ -129,9 +129,17 @@ class Ecu
|
|
|
129
129
|
raise DcmParserError.new("#{e.message} on #{e.backtrace.first} (state: #{@state})", lexer)
|
|
130
130
|
end
|
|
131
131
|
end
|
|
132
|
+
fail_on_truncation!
|
|
132
133
|
[labels, headers, subheaders]
|
|
133
134
|
end
|
|
134
135
|
|
|
136
|
+
# A well-formed file ends between labels, not inside one.
|
|
137
|
+
def fail_on_truncation!
|
|
138
|
+
return if %i[PRE_HEADER POST_HEADER].include?(@state)
|
|
139
|
+
|
|
140
|
+
raise DcmParserError.new("Unexpected end of file (state: #{@state})", lexer)
|
|
141
|
+
end
|
|
142
|
+
|
|
135
143
|
def debug_token(tok)
|
|
136
144
|
if tok == :UNKNOWN_CHAR
|
|
137
145
|
"UNKNOWN_CHAR: #{lexer.token_value}"
|
|
@@ -12,13 +12,14 @@ class Ecu
|
|
|
12
12
|
|
|
13
13
|
def message = @msg
|
|
14
14
|
def context
|
|
15
|
-
|
|
16
|
-
.lines[ctx_startline..ctx_endline]
|
|
15
|
+
lines[ctx_startline..ctx_endline]
|
|
17
16
|
.each
|
|
18
17
|
.with_index(ctx_startline + 1)
|
|
19
18
|
.map { |line, n| present(line, n, n == lineno) }
|
|
20
19
|
end
|
|
21
20
|
|
|
21
|
+
def lines = @lines ||= doc.lines
|
|
22
|
+
|
|
22
23
|
def present(line, n, highlight)
|
|
23
24
|
case highlight
|
|
24
25
|
when true then fmt(n) + " => | " + line
|
|
@@ -27,7 +28,7 @@ class Ecu
|
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def ctx_startline = [0, lineno - CTXLENGHT].max
|
|
30
|
-
def ctx_endline = @endline ||= [
|
|
31
|
+
def ctx_endline = @endline ||= [lines.size - 1, lineno + CTXLENGHT].min
|
|
31
32
|
def fmt_str = "%#{(ctx_endline + 1).to_s.length}d"
|
|
32
33
|
def fmt(n) = fmt_str % n
|
|
33
34
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require_relative "festwert"
|
|
2
4
|
require_relative "festwerteblock"
|
|
3
5
|
require_relative "kennlinie"
|
|
@@ -18,7 +20,7 @@ class Ecu
|
|
|
18
20
|
def self.from_dcm(str)
|
|
19
21
|
DcmParser.new(str)
|
|
20
22
|
.then { _1.call }
|
|
21
|
-
.then { new(*_1
|
|
23
|
+
.then { new(*_1) }
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
def self.from_dcm_partial(str)
|
|
@@ -29,7 +31,7 @@ class Ecu
|
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
def to_dcm(indented=false)
|
|
32
|
-
buf =
|
|
34
|
+
buf = +""
|
|
33
35
|
|
|
34
36
|
unless headers.empty?
|
|
35
37
|
headers.each { buf << "* " << _1 << "\n" }
|
data/lib/ecu/version.rb
CHANGED