Skip to content

Commit

Permalink
Channel name can be empty string (#100)
Browse files Browse the repository at this point in the history
* Update changelog and version
  • Loading branch information
c4deszes authored Aug 20, 2022
1 parent b682d16 commit 1128168
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.15.0] - 2022-08-20

### Added

- BCD values are now checked when decoding physical values

### Changes

- Master and slaves declarations are now optional
- Channel name can now be any string, including an empty string instead of requiring a valid C
identifier.

## [0.14.0] - 2022-02-26

Expand Down
4 changes: 4 additions & 0 deletions ldfparser/grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def ldf_integer(self, tree):
def ldf_float(self, tree):
return self.parse_real_or_integer(tree[0])

def ldf_channel_name(self, tree):
# This gets rid of quote marks
return tree[0][1:-1]

def start(self, tree):
return tree[0]

Expand Down
3 changes: 2 additions & 1 deletion ldfparser/grammars/ldf.lark
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ ldf_identifier: CNAME
ldf_version: C_VERSION
ldf_integer: C_INT
ldf_float: C_FLOAT
ldf_channel_name: ESCAPED_STRING

// LIN 2.1 Specification, section 9.2.1
header_lin_description_file: "LIN_description_file" ";"
header_protocol_version: "LIN_protocol_version" "=" "\"" ldf_version "\"" ";"
header_language_version: "LIN_language_version" "=" "\"" ldf_version "\"" ";"
header_speed: "LIN_speed" "=" ldf_float "kbps" ";"
header_channel: "Channel_name" "=" "\"" ldf_identifier "\"" ";"
header_channel: "Channel_name" "=" ldf_channel_name ";"

// LIN 2.1 Specification, section 9.2.2
nodes: "Nodes" "{" nodes_master? nodes_slaves? "}"
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[metadata]
version = 0.14.0
version = 0.15.0
1 change: 1 addition & 0 deletions tests/ldf/no_signal_subscribers.ldf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ LIN_description_file;
LIN_protocol_version = "2.2";
LIN_language_version = "2.2";
LIN_speed = 19.2 kbps;
Channel_name = "";

Nodes {
Master: master, 5.0 ms, 0.1 ms;
Expand Down

0 comments on commit 1128168

Please sign in to comment.