Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a docgen tool #632

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Create a docgen tool #632

wants to merge 2 commits into from

Conversation

nlachfr
Copy link
Contributor

@nlachfr nlachfr commented Jan 15, 2023

Add a small utility for generating the list of standard definitions of the specification.
The added descriptions comes directly from the current specification.

Output example (with markdown formatting) :

These descriptions are automatically generated based on the cel-go implementation.

Symbol Type Description
!_ (bool) -> bool logical not
-_ (int) -> int negation
(double) -> double negation
_!=_ (A, A) -> bool inequality
_%_ (int, int) -> int arithmetic
(uint, uint) -> uint arithmetic
_&&_ (bool, bool) -> bool logical and
_*_ (int, int) -> int arithmetic
(uint, uint) -> uint arithmetic
(double, double) -> double arithmetic
_+_ (int, int) -> int arithmetic
(uint, uint) -> uint arithmetic
(double, double) -> double arithmetic
(string, string) -> string string concatenation. Space and time cost proportional to the sum of the input sizes.
(bytes, bytes) -> bytes bytes concatenation
(list(A), list(A)) -> list(A) list concatenation. Space and time cost proportional to the sum of the input sizes.
(google.protobuf.Timestamp, google.protobuf.Duration) -> google.protobuf.Timestamp arithmetic
(google.protobuf.Duration, google.protobuf.Timestamp) -> google.protobuf.Timestamp arithmetic
(google.protobuf.Duration, google.protobuf.Duration) -> google.protobuf.Duration arithmetic
_-_ (int, int) -> int arithmetic
(uint, uint) -> uint arithmetic
(double, double) -> double arithmetic
(google.protobuf.Timestamp, google.protobuf.Timestamp) -> google.protobuf.Duration arithmetic
(google.protobuf.Timestamp, google.protobuf.Duration) -> google.protobuf.Timestamp arithmetic
(google.protobuf.Duration, google.protobuf.Duration) -> google.protobuf.Duration arithmetic
_/_ (int, int) -> int arithmetic
(uint, uint) -> uint arithmetic
(double, double) -> double arithmetic
_<=_ (bool, bool) -> bool ordering
(int, int) -> bool ordering
(int, double) -> bool ordering
(int, uint) -> bool ordering
(uint, uint) -> bool ordering
(uint, double) -> bool ordering
(uint, int) -> bool ordering
(double, double) -> bool ordering
(double, int) -> bool ordering
(double, uint) -> bool ordering
(string, string) -> bool ordering
(bytes, bytes) -> bool ordering
(google.protobuf.Timestamp, google.protobuf.Timestamp) -> bool ordering
(google.protobuf.Duration, google.protobuf.Duration) -> bool ordering
_<_ (bool, bool) -> bool ordering
(int, int) -> bool ordering
(int, double) -> bool ordering
(int, uint) -> bool ordering
(uint, uint) -> bool ordering
(uint, double) -> bool ordering
(uint, int) -> bool ordering
(double, double) -> bool ordering
(double, int) -> bool ordering
(double, uint) -> bool ordering
(string, string) -> bool ordering
(bytes, bytes) -> bool ordering
(google.protobuf.Timestamp, google.protobuf.Timestamp) -> bool ordering
(google.protobuf.Duration, google.protobuf.Duration) -> bool ordering
_==_ (A, A) -> bool equality
_>=_ (bool, bool) -> bool ordering
(int, int) -> bool ordering
(int, double) -> bool ordering
(int, uint) -> bool ordering
(uint, uint) -> bool ordering
(uint, double) -> bool ordering
(uint, int) -> bool ordering
(double, double) -> bool ordering
(double, int) -> bool ordering
(double, uint) -> bool ordering
(string, string) -> bool ordering
(bytes, bytes) -> bool ordering
(google.protobuf.Timestamp, google.protobuf.Timestamp) -> bool ordering
(google.protobuf.Duration, google.protobuf.Duration) -> bool ordering
_>_ (bool, bool) -> bool ordering
(int, int) -> bool ordering
(int, double) -> bool ordering
(int, uint) -> bool ordering
(uint, uint) -> bool ordering
(uint, double) -> bool ordering
(uint, int) -> bool ordering
(double, double) -> bool ordering
(double, int) -> bool ordering
(double, uint) -> bool ordering
(string, string) -> bool ordering
(bytes, bytes) -> bool ordering
(google.protobuf.Timestamp, google.protobuf.Timestamp) -> bool ordering
(google.protobuf.Duration, google.protobuf.Duration) -> bool ordering
_?_:_ (bool, A, A) -> A The conditional operator. See above for evaluation semantics. Will evaluate the test and only one of the remaining sub-expressions.
_[_] (list(A), int) -> A list indexing. Constant time cost.
(map(A, B), A) -> B map indexing. For string keys, cost is proportional to the size of the map keys times the size of the index string.
_||_ (bool, bool) -> bool logical or
bool type(bool) type denotation
(bool) -> bool type conversion
(string) -> bool type conversion
bytes type(bytes) type denotation
(bytes) -> bytes type conversion
(string) -> bytes type conversion
contains string.(string) -> bool Tests whether the string operand contains the substring. Time cost proportional to the product of sizes of the arguments.
double type(double) type denotation
(double) -> double type conversion
(int) -> double type conversion
(uint) -> double type conversion
(string) -> double type conversion
duration (google.protobuf.Duration) -> google.protobuf.Duration type conversion
(string) -> google.protobuf.Duration Type conversion. Duration strings should support the following suffixes: "h" (hour), "m" (minute), "s" (second), "ms" (millisecond), "us" (microsecond), and "ns" (nanosecond). Duration strings may be zero, negative, fractional, and/or compound. Examples: "0", "-1.5h", "1m6s"
(int) -> google.protobuf.Duration type conversion
dyn (A) -> dyn type conversion
endsWith string.(string) -> bool Tests whether the string operand ends with the suffix argument. Time cost proportional to the product of the sizes of the arguments.
getDate google.protobuf.Timestamp.() -> int get day of month from the date in UTC, one-based indexing
google.protobuf.Timestamp.(string) -> int get day of month from the date with timezone, one-based indexing
getDayOfMonth google.protobuf.Timestamp.() -> int get day of month from the date in UTC, zero-based indexing
google.protobuf.Timestamp.(string) -> int get day of month from the date with timezone, zero-based indexing
getDayOfWeek google.protobuf.Timestamp.() -> int get day of week from the date in UTC, zero-based, zero for Sunday
google.protobuf.Timestamp.(string) -> int get day of week from the date with timezone, zero-based, zero for Sunday
getDayOfYear google.protobuf.Timestamp.() -> int get day of year from the date in UTC, zero-based indexing
google.protobuf.Timestamp.(string) -> int get day of year from the date with timezone, zero-based indexing
getFullYear google.protobuf.Timestamp.() -> int get year from the date in UTC
google.protobuf.Timestamp.(string) -> int get year from the date with timezone
getHours google.protobuf.Timestamp.() -> int get hours from the date in UTC, 0-23
google.protobuf.Timestamp.(string) -> int get hours from the date with timezone, 0-23
google.protobuf.Duration.() -> int get hours from duration
getMilliseconds google.protobuf.Timestamp.() -> int get milliseconds from the date in UTC, 0-999
google.protobuf.Timestamp.(string) -> int get milliseconds from the date with timezone, 0-999
google.protobuf.Duration.() -> int milliseconds from duration, 0-999
getMinutes google.protobuf.Timestamp.() -> int get minutes from the date in UTC, 0-59
google.protobuf.Timestamp.(string) -> int get minutes from the date with timezone, 0-59
google.protobuf.Duration.() -> int get minutes from duration
getMonth google.protobuf.Timestamp.() -> int get month from the date in UTC, 0-11
google.protobuf.Timestamp.(string) -> int get month from the date with timezone, 0-11
getSeconds google.protobuf.Timestamp.() -> int get seconds from the date in UTC, 0-59
google.protobuf.Timestamp.(string) -> int get seconds from the date with timezone, 0-59
google.protobuf.Duration.() -> int get seconds from duration
in (A, list(A)) -> bool list membership. Time cost proportional to the product of the size of both arguments.
(A, map(A, B)) -> bool map key membership. Time cost proportional to the product of the size of both arguments.
int type(int) type denotation
(int) -> int type conversion
(uint) -> int type conversion
(double) -> int Type conversion. Rounds toward zero, then errors if result is out of range.
(string) -> int type conversion
(google.protobuf.Timestamp) -> int type conversion
(google.protobuf.Duration) -> int Convert timestamp to int64 in seconds since Unix epoch.
list type(list(A)) type denotation
map type(map(A, B)) type denotation
matches (string, string) -> bool Matches first argument against regular expression in second argument. Time cost proportional to the product of the sizes of the arguments.
string.(string) -> bool Matches the self argument against regular expression in first argument. Time cost proportional to the product of the sizes of the arguments.
null_type type(null) type denotation
size string.() -> int string size
bytes.() -> int length size
list(A).() -> int list size. Time cost proportional to the length of the list.
map(A, B).() -> int map size. Time cost proportional to the number of entries.
(string) -> int string length
(bytes) -> int bytes length
(list(A)) -> int list size. Time cost proportional to the length of the list.
(map(A, B)) -> int map size. Time cost proportional to the number of entries.
startsWith string.(string) -> bool Tests whether the string operand starts with the prefix argument. Time cost proportional to the product of the sizes of the arguments.
string type(string) type denotation
(string) -> string type conversion
(bool) -> string type conversion
(int) -> string type conversion
(uint) -> string type conversion
(double) -> string type conversion
(bytes) -> string type conversion
(google.protobuf.Timestamp) -> string type conversion, using the same format as timestamp string parsing
(google.protobuf.Duration) -> string type conversion, using the same format as duration string parsing
timestamp (google.protobuf.Timestamp) -> google.protobuf.Timestamp type conversion
(string) -> google.protobuf.Timestamp Type conversion of strings to timestamps according to RFC3339. Example: "1972-01-01T10:00:20.021-05:00"
(int) -> google.protobuf.Timestamp type conversion
type type(dyn) type denotation
(A) -> type(A) returns type of value
uint type(uint) type denotation
(uint) -> uint type conversion
(int) -> uint type conversion
(double) -> uint Type conversion. Rounds toward zero, then errors if result is out of range.
(string) -> uint type conversion

Resolves #9

@TristonianJones
Copy link
Collaborator

/gcbrun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a docgen tool
2 participants