qmic/tests/symbolic_values.qmi
Alex Elder ed896c97dc parser: add support for constant value substitution
Register symbolic constants as defined symbols when they are
defined.  When a constant symbol reference occurs after it's
been defined, the parsed token is modified to be a number type,
whose value is the value constant symbol.

One difference between a "normal" number token and a "constant"
number token is that the the string in a constant token contains
a copy of the symbolic name, whereas its a null pointer for a
"normal" number.

Signed-off-by: Alex Elder <elder@linaro.org>
Message-Id: <20211001232338.769309-35-elder@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2021-10-04 14:19:51 -05:00

27 lines
549 B
Plaintext

package test;
# Request identifiers
const TEST_REQUEST_RESPONSE = 35;
const TEST_INDICATION = 37;
# Message field identifiers
const QMI_RESULT = 2;
struct qmi_result {
u16 result;
u16 error;
};
request test_request {
required u8 test_number = 0x12;
} = TEST_REQUEST_RESPONSE; # Value 35 gets substitued
response test_response {
# Value 2 gets substitued for QMI_RESULT
required qmi_result r = QMI_RESULT;
} = TEST_REQUEST_RESPONSE;
indication test_indication {
optional u64 value = 0x99;
} = TEST_INDICATION; # Value 37 gets substitued