From 99eff7b576e8ec7c6fcde0515d31a6ec4a834bfc Mon Sep 17 00:00:00 2001 From: Jon Anderson Date: Mon, 26 Jan 2026 16:50:54 -0800 Subject: [PATCH 1/2] Merge BLEN with NUMBER. New keywords. --- docs/js/fql.js | 42 ++++++++++++------------------------------ 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/docs/js/fql.js b/docs/js/fql.js index 889c47d9..1cbe7894 100644 --- a/docs/js/fql.js +++ b/docs/js/fql.js @@ -17,26 +17,7 @@ /\d*/, /e?/, /\d*/, - ], - beginScope: { - 1: 'accent', - 2: 'number', - 3: 'accent', - 4: 'number', - 5: 'accent', - 6: 'number', - }, - }; - - const BLEN = { - begin: [ - /-?/, - /\d+/, - /\.?/, - /\d*/, - /e?/, - /\d*/, - /kb/, + /(kb|mb|gb)?/, // allow a byte-unit to appear after numbers. ], beginScope: { 1: 'accent', @@ -155,6 +136,9 @@ 'f32', 'f64', 'f80', + 'bigendian', + 'width', + 'unsigned', 'reverse', 'limit', 'mode', @@ -174,17 +158,18 @@ keyword: [ 'be', 'le', - 'i8', - 'i16', - 'i32', - 'i64', + 'w8', + 'w16', + 'w32', + 'w64', + 'w80', 'u8', 'u16', 'u32', 'u64', - 'f32', - 'f64', - 'f80', + 'endian', + 'width', + 'unsigned', 'reverse', 'limit', 'mode', @@ -273,7 +258,6 @@ UUID, VSTAMP, BYTES, - BLEN, NUMBER, OPTIONS, ], @@ -292,7 +276,6 @@ UUID, VSTAMP, BYTES, - BLEN, NUMBER, OPTIONS, ], @@ -320,7 +303,6 @@ UUID, VSTAMP, BYTES, - BLEN, NUMBER, OPTIONS, { // Highlight lone bar & semicolon for inline text. From 62c82371a3ea74c78a6b6c5e13a27142eb0c41cb Mon Sep 17 00:00:00 2001 From: Jon Anderson Date: Mon, 26 Jan 2026 18:40:59 -0800 Subject: [PATCH 2/2] Expandend options section. --- docs/index.md | 79 +++++++++++++++++++++++++++++--------------------- docs/js/fql.js | 30 ++++++++++++++----- 2 files changed, 69 insertions(+), 40 deletions(-) diff --git a/docs/index.md b/docs/index.md index a1343993..c5561cdd 100644 --- a/docs/index.md +++ b/docs/index.md @@ -446,52 +446,65 @@ encoded as a little-endian unsigned 8-bit integer, the following options would be included after the element. ```language-fql -3548[u8,le] +3548[u8] ``` Similarly, if a variable should only match against -a big-endian 32-bit floats then the following options would -be included after the `num` type. +big-endian 32-bit floats then the following options would be +included after the `num` type. ```language-fql ``` -### Element Options +### Value Encoding -The tables below show which options are supported for the -`int` and `num` types when used as values. These options -control how the data is serialized and unserialized. +The table below shows options for the `int` and `num` types. +These options control how data is [encoded](#data-encoding) +as a value.
-| Int Option | Description | -|:-----------|:----------------| -| `be` | Big endian | -| `le` | Little endian | -| `u8` | Unsigned 8-bit | -| `u16` | Unsigned 16-bit | -| `u32` | Unsigned 32-bit | -| `u64` | Unsigned 64-bit | -| `i8` | Signed 8-bit | -| `i16` | Signed 16-bit | -| `i32` | Signed 32-bit | -| `i64` | Signed 64-bit | +| Value Option | Argument | Description | +|:-------------|:---------|:---------------------------------------| +| `width` | `int` | Bit width: `8`, `16`, `32`, `64`, `80` | +| `bigendian` | none | Use big endian encoding | +| `unsigned` | none | Use unsigned encoding |
+ +Options are one of the more verbose parts of FQL. To avoid +obscuring the structure of a query, `int` and `num` options +are given shorter aliases. + +
+ +| Int Alias Option | Actual Option | +|:-------------------|:--------------------| +| `be` | `bigendian` | +| `i8` | `width:8` | +| `i16` | `width:16` | +| `i32` | `width:32` | +| `i64` | `width:64` | +| `u8` | `unsigned,width:8` | +| `u16` | `unsigned,width:16` | +| `u32` | `unsigned,width:32` | +| `u64` | `unsigned,width:64` | + +
+
-| Num Option | Description | -|:-----------|:--------------| -| `be` | Big endian | -| `le` | Little endian | -| `f32` | 32-bit | -| `f64` | 64-bit | -| `f80` | 80-bit | +| Num Alias Option | Actual Option | +|:-------------------|:--------------------| +| `be` | `bigendian` | +| `f32` | `width:32` | +| `f64` | `width:64` | +| `f80` | `width:80` |
-### Query Options +### Queries Query options are specified on the line before the query. For instance, to specify that a range-read query should read @@ -509,12 +522,12 @@ specify the option's behavior.
-| Query Option | Argument | Description | -|:-------------|:---------|:-----------------------------------| -| `reverse` | none | Range read in reverse order | -| `limit` | int | Maximum number of results | -| `mode` | name | Range read mode: want_all, iterator, exact, small, medium, large, serial | -| `snapshot` | none | Use snapshot read | +| Query Option | Argument | Description | +|:-------------|:---------|:-----------------------------------------| +| `reverse` | none | Range read in reverse order | +| `limit` | `int` | Maximum number of results | +| `mode` | name | Range read mode: `want_all`, `iterator`, `exact`, `small`, `medium`, `large`, `serial` | +| `snapshot` | none | Use snapshot read | | `strict` | none | Error when a read key-values doesn't conform to the schema |
diff --git a/docs/js/fql.js b/docs/js/fql.js index 1cbe7894..461ecd92 100644 --- a/docs/js/fql.js +++ b/docs/js/fql.js @@ -124,7 +124,6 @@ 'max', 'count', 'be', - 'le', 'i8', 'i16', 'i32', @@ -142,6 +141,13 @@ 'reverse', 'limit', 'mode', + 'want_all', + 'iterator', + 'exact', + 'small', + 'medium', + 'large', + 'serial', 'snapshot', 'strict', 'rand', @@ -157,16 +163,17 @@ $$pattern: /[^,:]+/, keyword: [ 'be', - 'le', - 'w8', - 'w16', - 'w32', - 'w64', - 'w80', + 'i8', + 'i16', + 'i32', + 'i64', 'u8', 'u16', 'u32', 'u64', + 'f32', + 'f64', + 'f80', 'endian', 'width', 'unsigned', @@ -192,6 +199,14 @@ ], }; + const INLINEOPT = { + scope: 'options', + begin: /(?=\b(?:width|unsigned)\b)/, + end: /(?=\s|$)/, + keywords: OPTIONS.keywords, + contains: OPTIONS.contains, + }; + const VARIABLE = { scope: 'variable', begin: /