F♭ (pronounced F-flat) is a toy language.
bool <- AstRule((((AnyCase("true") !core.identifierNext) / (AnyCase("false") !core.identifierNext)) !identifierNext))
bracket <- AstRule(advanceIf([[]{}()]))
comment <- (fullComment / lineComment)
decimal <- ((plusOrMinus? (integer (fraction? (exponent? advanceIf([%])?)))) !advanceIf((![ \t\n\r\f,'\"``,[]{}():] / core.atDigit)))
decimalFraction <- ((plusOrMinus? (integer? (fraction (exponent? advanceIf([%])?)))) !advanceIf((![ \t\n\r\f,'\"``,[]{}():] / core.atDigit)))
delimiter <- advanceIf([ \t\n\r\f,])+
digit <- advanceIf((core.atDigit / [_]))
digits <- digit+
doubleQuotedString <- AstRule(("\"" ((advanceIf(![\"])* / <predicate>) ("\"" / <predicate>))))
escapedChar <- (advanceIf([\\]) core.advance)
exponent <- (advanceIf([eE]) (plusOrMinus? digits))
fraction <- ("." integer)
fullComment <- ("/*" (advanceIf(!"*/")* "*/"))
i <- AstRule(((AnyCase("i") !core.identifierNext) !identifierNext))
identifier <- (identifierFirst identifierNext*)
identifierFirst <- advanceIf(![ \t\n\r\f,'\"``,[]{}()])
identifierNext <- advanceIf(![ \t\n\r\f,'\"``,[]{}():])
integer <- (core.digit+ digit*)
key <- AstRule((identifier advanceIf([:])))
lineComment <- ("//" untilEol)
literal <- (bool / (null / (nan / i)))
nan <- AstRule(((AnyCase("nan") !core.identifierNext) !identifierNext))
null <- AstRule(((AnyCase("null") !core.identifierNext) !identifierNext))
number <- AstRule((radix / (decimal / (decimalFraction / integer))))
plusOrMinus <- advanceIf([+-])
radix <- ((plusOrMinus? ("0" (advanceIf([oObBxF]) (radixInteger (radixFraction? radixExponent?))))) !advanceIf((![ \t\n\r\f,'\"``,[]{}():] / ([0123456789abcdefABCDEF] / [_]))))
radixDigit <- advanceIf(([0123456789abcdefABCDEF] / [_]))
radixExponent <- (advanceIf([eEpP]) (plusOrMinus? radixDigit+))
radixFraction <- ("." radixInteger)
radixInteger <- (rawRadixDigit+ radixDigit*)
rawRadixDigit <- advanceIf([0123456789abcdefABCDEF])
sequence <- (value (ws value)*)?
singleQuotedString <- AstRule(("'" ((advanceIf(!['])* / <predicate>) ("'" / <predicate>))))
string <- (templateString / (singleQuotedString / doubleQuotedString))
symbol <- AstRule((advanceIf([#]) identifier))
templateString <- AstRule(("`" ((advanceIf(![`])* / <predicate>) ("`" / <predicate>))))
untilEol <- (advanceIf(!core.newLine)* core.newLine?)
value <- (comment / (number / (symbol / (literal / (key / (word / (string / bracket)))))))
word <- AstRule(identifier)
ws <- (delimiter / advanceIf(core.atWs))*
bracket
identifierFirst
identifierNext
identifier
word
key
digit
digits
integer
fraction
plusOrMinus
exponent
decimal
decimalFraction
rawRadixDigit
radixDigit
radixInteger
radixFraction
radixExponent
radix
number
untilEol
fullComment
lineComment
comment
delimiter
ws
symbol
bool
null
nan
i
literal
escapedChar
templateString
singleQuotedString
doubleQuotedString
string
value
sequence