This commit is contained in:
deeaitch committed 2026-10-20 13:21:43 -04:00
1 parent e555ebb571
commit 849ce31e2f
17 files changed
+675 -35

No files matched your search

+44 -4
View File
@@ -647,11 +647,52 @@ retain their original source lines. Invalid signal markers use `InvalidStatement
`HasErrors()` checks severity; warnings alone do not make a parse fail.
Unknown statements are reported conservatively, including `SIG_VALTYPE_`,
attributes (`BA_`, `BA_DEF_`, defaults and relation forms), signal types/references,
attribute relation forms (`BA_REL_`, `BA_DEF_REL_`), signal types/references,
environment variables, named `VAL_TABLE_` tables, and vendor extensions. For
example, ignoring `SIG_VALTYPE_` may decode a floating-point signal as an integer.
The parser does not implement the warned features; consumers should review warnings.
### Attributes and frame metadata
`BA_DEF_`, `BA_DEF_DEF_`, and `BA_` support database, `BO_`, `SG_`,
`BU_`, and `EV_` scopes with `INT`, `HEX`, `FLOAT`, `STRING`, and `ENUM`
definitions. Integer/HEX values use decimal signed 64-bit numbers; floating
values are finite and locale independent. ENUM assignments use zero-based indices;
defaults accept an index or a quoted label. Strings support escaped quotes and
backslashes. Each statement occupies one physical line and ends with `;`.
```dbc
BA_DEF_ BO_ "VFrameFormat" ENUM "StandardCAN","ExtendedCAN","StandardCAN_FD";
BA_DEF_DEF_ "VFrameFormat" "StandardCAN";
BA_DEF_ BO_ "GenMsgCycleTime" INT 0 10000;
BA_DEF_DEF_ "GenMsgCycleTime" 100;
BA_ "GenMsgCycleTime" BO_ 256 20;
```
Definitions, defaults, assignments, and frame/signal declarations may appear in
any order. Defaults apply to every object of the defined scope; explicit values
override them, with the last repeated assignment winning. Duplicate definitions
or defaults, undefined names, wrong types/scopes, out-of-range values, and missing
frame/signal targets produce `Error / InvalidAttribute` at the source line.
`DbcDatabase::attributeDefinitions` retains types, ranges, enum labels, and defaults;
`attributeAssignments` retains explicit values and targets. Effective values are
available in `attributes` on the database, frames and signals. Node/environment
assignments are retained by name without checking declarations; their defaults
remain on the definitions. Frame/signal attributes are copied into runtime
snapshots and tree payloads. Other valid attributes remain available as metadata
without changing decoding.
`FrameInfo` and `DecodeFrame` expose optional `frameFormat` (the enum label) and
`cycleTimeMs` (`GenMsgCycleTime`, unsigned 32-bit milliseconds). Missing values
remain unset; zero cycle time means unspecified. `StandardCAN` and `ExtendedCAN`
are recognized. Other format labels, including CAN FD and `J1939PG`, are preserved
with `Warning / UnsupportedAttribute` when effective on a frame. A supported
format conflicting with the encoded `BO_` ID also warns. Warnings identify the
assignment or default line. Attributes do not change CAN ID normalization or
automatically enable CAN FD or J1939 decoding; J1939 still requires parser opt-in.
Use `ParseFileWithDiagnostics()` to review these warnings.
Common `VERSION`, `NS_`, `BS_`, and `BU_` headers produce no diagnostics.
Single-token symbols inside the `NS_` declaration list are quiet regardless of
indentation, even when they name unsupported syntax. Frame, signal, bus, and
@@ -1207,8 +1248,7 @@ Not supported yet:
- extended and nested multiplexing (`SG_MUL_VAL_`, `mNM`)
- named `VAL_TABLE_` tables and environment-variable value descriptions
- `BA_` attributes
- `BA_DEF_` definitions and attribute defaults
- attribute relation forms (`BA_REL_`, `BA_DEF_REL_`)
- `SIG_VALTYPE_` floating-point signal types
- signal types/references (`SGTYPE_`, `SIG_TYPE_REF_`) and environment variables
- advanced comment handling
@@ -1264,7 +1304,7 @@ Recommended additions:
Recommended additions:
- basic multiplexing (implemented)
- attribute parsing
- attribute parsing (implemented for definitions, defaults and values)
- richer J1939 support
- CSV export of decoded traces
- optimized filtering and signal selection