Skip to content

Commit 9a0bd72

Browse files
Merge pull request #25 from UAVCAN/service-response-marker
Grammar updates per the Spec review suggestions
2 parents 9cef74c + e9d9a61 commit 9a0bd72

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pydsdl/_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def _unittest_simple() -> None:
143143
vendor.nested.Empty.255.255 new_empty_implicit
144144
vendor.nested.Empty.255.255 new_empty_explicit
145145
vendor.nested.Empty.255.254 old_empty
146-
---#---#---#---#---#---#---#---#---
146+
-----------------------------------
147147
Constants.5.0 constants # RELATIVE REFERENCE
148148
vendor.nested.Abc.1.2 abc
149149
''')

pydsdl/grammar.parsimonious

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ comment = ~r"#[^\r\n]*"
44
end_of_line = ~r"\r?\n" # Unix/Windows
55
_ = ~r"[ \t]+" # Whitespace
66

7+
identifier = ~r"[a-zA-Z_][a-zA-Z0-9_]*"
8+
79
# ==================================================== Statements ====================================================
810

911
statement = statement_directive
@@ -18,15 +20,13 @@ statement_constant = type _ identifier _? "=" _? expression
1820
statement_field = type _ identifier
1921
statement_padding_field = type_void "" # The trailing empty symbol is to prevent the node from being optimized away.
2022

21-
statement_service_response_marker = "---" # Separates request/response, specifies that the definition is a service.
23+
statement_service_response_marker = ~r"---+" # Separates request/response, specifies that the definition is a service.
2224

2325
statement_directive = statement_directive_with_expression
2426
/ statement_directive_without_expression
2527
statement_directive_with_expression = "@" identifier _ expression # The expression type must match the directive.
2628
statement_directive_without_expression = "@" identifier
2729

28-
identifier = ~r"[a-zA-Z_][a-zA-Z0-9_]*"
29-
3030
# ==================================================== Data types ====================================================
3131

3232
type = type_array

0 commit comments

Comments
 (0)