ppoppo-sigil-parser 0.20.0

Parser for the ppoppo `@@/` chat sigil grammar — entity references, verbs, scopes, modifiers
Documentation
[
  {
    "_comment": "── ls (collection only) ────────────────",
    "input": "@@/ls #*",
    "verb": "ls",
    "target": { "type": "scope", "scope": "channel", "modifier": "all" },
    "args": []
  },
  {
    "input": "@@/ls @*",
    "verb": "ls",
    "target": { "type": "scope", "scope": "user", "modifier": "all" },
    "args": []
  },
  {
    "input": "@@/ls :*",
    "verb": "ls",
    "target": { "type": "named", "modifier": "all" },
    "args": []
  },

  {
    "_comment": "── cat (instance) ──────────────────────",
    "input": "@@/cat @~",
    "verb": "cat",
    "target": { "type": "scope", "scope": "user", "modifier": "current" },
    "args": []
  },
  {
    "input": "@@/cat @~ email",
    "verb": "cat",
    "target": { "type": "scope", "scope": "user", "modifier": "current" },
    "args": ["email"]
  },
  {
    "input": "@@/cat @alice",
    "verb": "cat",
    "target": { "type": "scope", "scope": "user", "modifier": "name", "name": "alice" },
    "args": []
  },
  {
    "input": "@@/cat #general",
    "verb": "cat",
    "target": { "type": "scope", "scope": "channel", "modifier": "name", "name": "general" },
    "args": []
  },
  {
    "input": "@@/cat #~",
    "verb": "cat",
    "target": { "type": "scope", "scope": "channel", "modifier": "current" },
    "args": []
  },
  {
    "input": "@@/cat ^",
    "verb": "cat",
    "target": { "type": "positional", "depth": 1 },
    "args": []
  },
  {
    "input": "@@/cat ^^",
    "verb": "cat",
    "target": { "type": "positional", "depth": 2 },
    "args": []
  },
  {
    "input": "@@/cat 01ARZ3NDEKTSV4RRFFQ69G5FAV",
    "verb": "cat",
    "target": { "type": "id", "value": "01ARZ3NDEKTSV4RRFFQ69G5FAV" },
    "args": []
  },
  {
    "input": "@@/cat :decision",
    "verb": "cat",
    "target": { "type": "named", "label": "decision" },
    "args": []
  },

  {
    "_comment": "── find (search term required) ─────────",
    "input": "@@/find #* team",
    "verb": "find",
    "target": { "type": "scope", "scope": "channel", "modifier": "all" },
    "args": ["team"]
  },
  {
    "input": "@@/find @* alice",
    "verb": "find",
    "target": { "type": "scope", "scope": "user", "modifier": "all" },
    "args": ["alice"]
  },
  {
    "input": "@@/find :* meeting",
    "verb": "find",
    "target": { "type": "named", "modifier": "all" },
    "args": ["meeting"]
  },

  {
    "_comment": "── grep ────────────────────────────────",
    "input": "@@/grep #~ keyword",
    "verb": "grep",
    "target": { "type": "scope", "scope": "channel", "modifier": "current" },
    "args": ["keyword"]
  },
  {
    "input": "@@/grep #* keyword",
    "verb": "grep",
    "target": { "type": "scope", "scope": "channel", "modifier": "all" },
    "args": ["keyword"]
  },
  {
    "input": "@@/grep #general keyword",
    "verb": "grep",
    "target": { "type": "scope", "scope": "channel", "modifier": "name", "name": "general" },
    "args": ["keyword"]
  },
  {
    "input": "@@/grep #~ hello world",
    "verb": "grep",
    "target": { "type": "scope", "scope": "channel", "modifier": "current" },
    "args": ["hello", "world"]
  },

  {
    "_comment": "── man ─────────────────────────────────",
    "input": "@@/man",
    "verb": "man",
    "target": null,
    "args": []
  },
  {
    "input": "@@/man cat",
    "verb": "man",
    "target": null,
    "args": ["cat"]
  },

  {
    "_comment": "── save ────────────────────────────────",
    "input": "@@/save ^",
    "verb": "save",
    "target": { "type": "positional", "depth": 1 },
    "args": []
  },
  {
    "input": "@@/save ^^",
    "verb": "save",
    "target": { "type": "positional", "depth": 2 },
    "args": []
  },
  {
    "input": "@@/save hello world",
    "verb": "save",
    "target": null,
    "args": ["hello", "world"]
  },
  {
    "input": "@@/save",
    "error": { "type": "missing_target", "verb": "save" }
  },

  {
    "_comment": "── set (Phase B) ──────────────────────",
    "input": "@@/set @~ email foo@bar.com",
    "verb": "set",
    "target": { "type": "scope", "scope": "user", "modifier": "current" },
    "args": ["email", "foo@bar.com"]
  },
  {
    "input": "@@/set @alice alias Kim",
    "verb": "set",
    "target": { "type": "scope", "scope": "user", "modifier": "name", "name": "alice" },
    "args": ["alias", "Kim"]
  },

  {
    "_comment": "── rm (Phase B) ───────────────────────",
    "input": "@@/rm :decision",
    "verb": "rm",
    "target": { "type": "named", "label": "decision" },
    "args": []
  },
  {
    "input": "@@/rm ^",
    "verb": "rm",
    "target": { "type": "positional", "depth": 1 },
    "args": []
  },
  {
    "input": "@@/rm @alice",
    "verb": "rm",
    "target": { "type": "scope", "scope": "user", "modifier": "name", "name": "alice" },
    "args": []
  },
  {
    "input": "@@/rm #general",
    "verb": "rm",
    "target": { "type": "scope", "scope": "channel", "modifier": "name", "name": "general" },
    "args": []
  },
  {
    "input": "@@/rm 01ARZ3NDEKTSV4RRFFQ69G5FAV",
    "verb": "rm",
    "target": { "type": "id", "value": "01ARZ3NDEKTSV4RRFFQ69G5FAV" },
    "args": []
  },

  {
    "_comment": "── lbl (Phase B) ──────────────────────",
    "input": "@@/lbl ^ decision",
    "verb": "lbl",
    "target": { "type": "positional", "depth": 1 },
    "args": ["decision"]
  },
  {
    "input": "@@/lbl ^^ action-item",
    "verb": "lbl",
    "target": { "type": "positional", "depth": 2 },
    "args": ["action-item"]
  },
  {
    "input": "@@/lbl 01ARZ3NDEKTSV4RRFFQ69G5FAV urgent",
    "verb": "lbl",
    "target": { "type": "id", "value": "01ARZ3NDEKTSV4RRFFQ69G5FAV" },
    "args": ["urgent"]
  },

  {
    "_comment": "── edge cases ──────────────────────────",
    "input": "@@/cat   @~   email",
    "verb": "cat",
    "target": { "type": "scope", "scope": "user", "modifier": "current" },
    "args": ["email"]
  },

  {
    "_comment": "── deprecated sigil errors ─────────────",
    "input": "@@/cat ~",
    "error": { "type": "deprecated_sigil", "message": "~ is removed. Use @~ (self) or #~ (current channel)" }
  },
  {
    "input": "@@/ls #",
    "error": { "type": "deprecated_sigil", "message": "Bare # is removed. Use #*" }
  },
  {
    "input": "@@/ls @",
    "error": { "type": "deprecated_sigil", "message": "Bare @ is removed. Use @*" }
  },
  {
    "input": "@@/ls *",
    "error": { "type": "deprecated_sigil", "message": "Bare * is removed. Use @* or #* separately" }
  },
  {
    "input": "@@/grep #here keyword",
    "error": { "type": "deprecated_sigil", "message": "#here is removed. Use #~" }
  },

  {
    "_comment": "── standard errors ─────────────────────",
    "input": "hello",
    "error": { "type": "not_sigil" }
  },
  {
    "input": "@@/",
    "error": { "type": "missing_verb" }
  },
  {
    "input": "@@/unknown @~",
    "error": { "type": "unknown_verb", "got": "unknown" }
  },
  {
    "input": "@@/ls",
    "error": { "type": "missing_target", "verb": "ls" }
  },
  {
    "input": "@@/grep",
    "error": { "type": "missing_target", "verb": "grep" }
  },
  {
    "input": "@@/ls something",
    "error": { "type": "missing_target", "verb": "ls" }
  },
  {
    "input": "hello @@/ls #*",
    "error": { "type": "not_sigil" }
  },
  {
    "input": "@@ hello",
    "error": { "type": "not_sigil" }
  },
  {
    "input": "@@/find #*",
    "error": { "type": "missing_search_term", "verb": "find" }
  }
]