Skip to content

Feature Request: [GRAMMAR] Easier way to negate string ((^) with sequence) #8953

@ExtReMLapin

Description

@ExtReMLapin

Prerequisites

  • I am running the latest code. Mention the version if possible as well.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new and useful enhancement to share.

Feature Description

A simpler way to "negate string" / negative lookahead /negative lookbehind similar to #2888 request.

Motivation

Hello,
Right now, let's say you want to output any string BUT "Date" you have to do something like

NonDate ::= "\""  ( [^D] | "D" [^aA] | "Da" [^Tt] | "Dat" [^eE]) asciichar{0,10}  "\""

Which can be translated to

  1. Your string can start but anything but a D
  2. If it starts with a D, then the second letter can't be a A
  3. Well if you really want a A, for sure, but next one can't be a T
  4. If you really want a T, sure but last chance , you can't put a E !

Which actually you will need to turn into something much more complex because the LLM is going to give you utf-8 letters, bypassing your rules.


root ::= dateforced | string
dateforced ::=  "\""  "Date lol"  "\"" 
string ::= EntityTypeNonDate 
EntityTypeNonDate ::= "\""  ( [^D\x00-\x40\U0000005B-\UFFFFFFFF] | "D" [^a\x00-\x60\U0000007B-\UFFFFFFFF] | "Da" [^t\x00-\x60\U0000007B-\UFFFFFFFF] | "Dat" [^e\x00-\x60\U0000007B-\UFFFFFFFF]) ASCIIEntityNameContinue{0,15}  "\""
ASCIICharLower ::= [a-z]
ASCIICharUpper ::= [A-Z]
ASCIIEntityName ::= ASCIIWordFirst (ASCIIWordNext){0,3}
ASCIIEntityNameContinue ::= (ASCIIWordNext){0,3}
ASCIIWordFirst ::= ASCIICharUpper ASCIICharLower{2,20}
ASCIIWordNext ::= ("-"|" ")? ASCIICharUpper? ASCIICharLower{2,20}

Possible Implementation

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions