Skip to content

Commit

Permalink
docs: JEP-012, JEP-013, JEP-014, JEP-015 misc grammar/typos (#178)
Browse files Browse the repository at this point in the history
Fixes for misc grammar issues and typos

<!-- ps-id: 5907d3e3-9a93-4dd6-b637-ecaf0e718a5c -->
  • Loading branch information
cawalch authored Dec 23, 2024
1 parent ff272c2 commit 6c996a9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions jep-012-raw-string-literals.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
This JEP proposes the following modifications to JMESPath in order to improve
the usability of the language and ease the implementation of parsers:


* Addition of a **raw string literal** to JMESPath that will allow expressions
to contain raw strings that are not mutated by JSON escape sequences (e.g.,
\\n”, “\\r”, “\\u005C”).
Expand Down Expand Up @@ -288,7 +287,7 @@ There are several alternative approaches that could be taken.
### Leave as-is

This is a valid and reasonable suggestion. Leaving JMESPath as-is would avoid
a breaking change to the grammar and users could continue to use multiple
a breaking change to the grammar, and users could continue to use multiple
escape characters to avoid delimiter collision.

The goal of this proposal is not to add functionality to JMESPath, but rather
Expand Down
4 changes: 2 additions & 2 deletions jep-013-object-manipulation-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This JEP introduces built-in functions to extract a list of key/value pairs from
array[array[any]] items(object $obj)
```

Returns a an array of key value pairs for the provided object `$obj`. Each pair is a 2-item array with the first item being the key and the second item being the value. This function is the inverse of the `from_items()` function.
Returns an array of key value pairs for the provided object `$obj`. Each pair is a 2-item array with the first item being the key and the second item being the value. This function is the inverse of the `from_items()` function.

Note that because JSON hashes are inheritently unordered, the key value pairs of the provided object `$obj` are inheritently unordered. Implementations are not required to return values in any specific order.

Expand Down Expand Up @@ -82,4 +82,4 @@ Accepts one or more arrays as arguments and returns an array of arrays in which

## Compliance tests

A new `objects.json` file will be added to the compliance test suite.
A new `objects.json` file will be added to the compliance test suite.
4 changes: 2 additions & 2 deletions jep-014-string-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ _Each function signature declares the types of its input parameters. If any type
```
int find_first(string $subject, string $sub[, int $start[, int $end]])
```
Given the `$subject` string, `find_first()` returns the zero-based index of the first occurence where the `$sub` substring appears in `$subject` or `null` if it does not appear. If either the `$subject` or the `$sub` argument is an empty string, `find_first()` returns `null`.
Given the `$subject` string, `find_first()` returns the zero-based index of the first occurrence where the `$sub` substring appears in `$subject` or `null` if it does not appear. If either the `$subject` or the `$sub` argument is an empty string, `find_first()` returns `null`.

The `$start` and `$end` parameters are optional and allow restricting to the slice `[$start:$end]` the range within `$subject` in which `$sub` must be found.

Expand Down Expand Up @@ -177,7 +177,7 @@ array[string] split(string $subject, string $search[, number $count])

Given the `$subject` string, `split()` breaks on occurrences of the string `$search` and returns an array.

The `split()` function returns an array containing each partial string between occurrences of `$search`. If `$subject` contains no occurrences of the `$search` string, an array containing just the original `$subject` string will be returned.
The `split()` function returns an array containing each partial string between occurrences of `$search`. If `$subject` contains no occurrences of the `$search` string, an array containing just the original `$subject` string will be returned.

If the `$search` argument is an empty string, `split()` breaks on every character and returns an array containing each character from the `$subject` string. Thus, if `$subject` is _also_ an empty string, `split()` returns an empty array.

Expand Down
4 changes: 2 additions & 2 deletions jep-015-string-slices.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ String manipulation functions are a frequently requested feature to be added to

## Slices

_This section outline word changes to the _Slices_ documentation of the grammar **in bold**._
_This section outlines word changes to the _Slices_ documentation of the grammar **in bold**._

```abnf
slice-expression = [number] ":" [number] [ ":" [number] ]
Expand All @@ -44,7 +44,7 @@ Slice expressions adhere to the following rules:
- If no `start` position is given, it is assumed to be `0` if the given `step` is greater than `0` or the end of the array **or string** if the given `step` is less than `0`.
- If a negative `stop` position is given, it is calculated as the total length of the array **or string** plus the given `stop` position.
- If no `stop` position is given, it is assumed to be the length of the array **or string** if the given `step` is greater than `0` or `0` if the given `step` is less than `0`.
- If the given `step` is omitted, it it assumed to be `1`.
- If the given `step` is omitted, it is assumed to be `1`.
- If the given `step` is `0`, an error MUST be raised.
- If the **object** being sliced is not an array **or string**, the result is `null`.
- If the **object** being sliced is an array **or string** and yields no results, the result MUST be an empty array **or empty string**.
Expand Down

0 comments on commit 6c996a9

Please sign in to comment.