Skip to content

Docs vs parser mismatches: substring ... from ... length, split ... by ..., and is not equal to #549

Description

@logbie

Summary

Three constructs that appear in the documentation (or read as natural WFL) are rejected by the parser in the current build. Either the parser or the docs should change so they agree.

Environment

  • WFL built from source, .build_meta.json: { "year": 26, "month": 6, "build": 5 }
  • Linux, release build

1. substring of <text> from <start> length <length>

Documented in Docs/05-standard-library/text-module.md:

substring of <text> from <start> length <length>

and used in Docs/04-advanced-features/web-servers.md:

store filename as substring of path from 8 length 100

But it fails to parse:

store t as substring of "abcdefghij" from 0 length 5   // Parse error: Unexpected token in expression: KeywordFrom

The and form works:

store t as substring of "abcdefghij" and 0 and 5       // OK -> "abcde"

2. split of <text> by <delimiter>

Documented in Docs/05-standard-library/text-module.md:

split of <text> by <delimiter>
...
store parts as split of csv by ","

But it fails to parse:

store parts as split of "a-b-c" by "-"                 // Parse error

The string_split ... and form works:

store parts as string_split of "a-b-c" and "-"         // OK -> ["a","b","c"]

3. is not equal to

is equal to works, but the natural negation does not parse:

check if n is not equal to 3:                          // Parse error: Unexpected token: KeywordEqual

Current workaround:

check if not (n is equal to 3):                        // OK

Expected

Either implement these documented/natural forms in the parser, or update the docs (and any example programs / web-servers.md) to only show the supported spellings (substring of X and START and LENGTH, string_split of X and DELIM, not (X is equal to Y)).

These are minor but they trip up anyone following the docs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions