From 8a38dc2d49b5260e3305cefc1945be245537bc7d Mon Sep 17 00:00:00 2001 From: matt-oliver-canada <102307342+matt-oliver-canada@users.noreply.github.com> Date: Sun, 25 Feb 2024 14:43:23 -0500 Subject: [PATCH] Support both upper and lower case E in scientific notation (#135) * Add support for upper case in values --- CHANGELOG.md | 6 ++++++ ldfparser/grammars/ldf.lark | 2 +- setup.cfg | 2 +- tests/ldf/lin_encoders.ldf | 7 +++++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71e3a2d..deeb350 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.24.0] - 2024-02-22 + +### Changed + +- scientific/engineeering notation values can now have upper case E + ## [0.23.0] - 2024-02-05 ### Changed diff --git a/ldfparser/grammars/ldf.lark b/ldfparser/grammars/ldf.lark index b20b620..8453801 100644 --- a/ldfparser/grammars/ldf.lark +++ b/ldfparser/grammars/ldf.lark @@ -122,7 +122,7 @@ signal_representations: "Signal_representation" "{" (signal_representation_node+ signal_representation_node: ldf_identifier ":" ldf_identifier ("," ldf_identifier)* ";" C_INT: ("0x"HEXDIGIT+) | ("-"? INT) -C_FLOAT: ("-"? INT ("." INT)?) ("e" ("+" | "-")? INT)? +C_FLOAT: ("-"? INT ("." INT)?) (("e" | "E")("+" | "-")? INT)? LIN_VERSION: INT "." INT ISO_VERSION: "ISO17987" ":" INT J2602_VERSION: "J2602" "_" INT "_" INT "." INT diff --git a/setup.cfg b/setup.cfg index 17bc7b2..352d405 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,2 @@ [metadata] -version = 0.23.0 +version = 0.24.0 diff --git a/tests/ldf/lin_encoders.ldf b/tests/ldf/lin_encoders.ldf index dfc5ba2..af68d88 100755 --- a/tests/ldf/lin_encoders.ldf +++ b/tests/ldf/lin_encoders.ldf @@ -95,6 +95,13 @@ Signal_encoding_types { BCDEncoding { bcd_value; } + ScientificEncoding { + physical_value, 0, 255, 5.6785558246e-04, 0, "Ohm"; + physical_value, 0, 255, 7.654E-02, 0, "Ohm"; + physical_value, 0, 1024, 3.778e02, 0, "Ohm"; + physical_value, 0, 1024, 1.222E09, 0, "Ohm"; + physical_value, 0, 65535, 3.5E+02, 5, "Ohm"; + } } Signal_representation {