diff --git a/diagrams/diagrams.py b/diagrams/diagrams.py index 7fb602b..d22b773 100644 --- a/diagrams/diagrams.py +++ b/diagrams/diagrams.py @@ -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( @@ -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') @@ -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: diff --git a/src/api/format-description.md b/src/api/format-description.md index d987aa0..08fb5af 100644 --- a/src/api/format-description.md +++ b/src/api/format-description.md @@ -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)