Skip to content

Commit

Permalink
Document [end] component
Browse files Browse the repository at this point in the history
  • Loading branch information
jhpratt committed Aug 27, 2023
1 parent c9b9829 commit 9e83164
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion diagrams/diagrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def __init__(self, name, diagram):

# region: individual components
def generate_diagram(name, *modifiers):
if len(modifiers) == 0:
return NamedDiagram(name, Diagram(Sequence(name)))

return NamedDiagram(
name,
Diagram(Sequence(
Expand Down Expand Up @@ -143,6 +146,7 @@ def generate_diagram(name, *modifiers):
copy(ignore_count),
)))
unix_timestamp = generate_diagram('unix_timestamp', copy(unix_timestamp_precision), copy(sign))
end = generate_diagram('end')

format_description = Comment('format_description')

Expand Down Expand Up @@ -170,7 +174,7 @@ def generate_diagram(name, *modifiers):
all = [
abbreviated_v1, abbreviated_v2,
day, month, ordinal, weekday, week_number, year, hour, minute, period, second, subsecond,
offset_hour, offset_minute, offset_second, first, optional, ignore, unix_timestamp
offset_hour, offset_minute, offset_second, first, optional, ignore, unix_timestamp, end
]

for item in all:
Expand Down
9 changes: 9 additions & 0 deletions src/api/format-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ ASCII whitespace characters.
`format_description` refers to a complete format description that is nested; whitespace (including
leading and trailing) is significant.

- **End of input**: `[end]`

![syntax for end component](../diagrams/end.svg#rr)

This component indicates the end of the input. When formatting, it is a no-op. When parsing, it
will only succeed if there is no further input. It does not consume any input.

There is no customization available for this component.

- **Clock hour**: `[hour]`

![syntax for hour component](../diagrams/hour.svg#rr)
Expand Down

0 comments on commit 9e83164

Please sign in to comment.