Skip to content

Grammar railroad diagram #231

@mingodad

Description

@mingodad

Going through the documentation and the code I've created an initial incomplete EBNF understood by https://github.com/GuntherRademacher/rr that can generate nice navigable railroad diagrams (see bellow with instructions at the top).

I've found that railroad diagrams are a nice and intuitive way to show a grammar as a whole in a way that helps document/develop/debug the same.

//
// EBNF to be viewd at
//    (IPV6) https://www.bottlecaps.de/rr/ui
//    (IPV4) https://rr.red-dove.com/ui
//
// Copy and paste this at one of the urls shown above in the 'Edit Grammar' tab
// then click the 'View Diagram' tab.
//

reflex::=
	  definitions "%%" rules "%%" user_code

user_code::=
	  /*%empty*/
	| USERCODE

definitions::=
	  /*%empty*/
	| definitions definition

definition::=
	  NL
	| is_code
	| is_top_code
	| is_class_code
	| is_init_code
	| is_begin_code
	| is_include
	| is_state
	| is_xstate
	| is_option
	| def_named_pattern

is_code::=
	  "%{" CODE_TILL_PCT_CURLY

is_top_code::=
	  "%top{" CODE_TILL_CURLY

is_class_code::=
	  "%class{" CODE_TILL_CURLY

is_init_code::=
	  "%init{" CODE_TILL_CURLY

is_begin_code::=
	  "%begin{" CODE_TILL_CURLY

is_include::=
	  "%include" STRING

is_state::=
	  "%state" name_list

is_xstate::=
	  "%xstate" name_list

name_list::=
	  NAME
	| name_list NAME

is_option::=
	  "%option" key_value_list

key_value_list::=
	  key_option
	| key_value_list key_option

key_option::=
	  "array"
	| "always_interactive"
	| "batch"
	| "bison"
	| "bison_bridge"
	| "bison_cc"
	| "bison_cc_namespace"
	| "bison_cc_parser"
	| "bison_complete"
	| "bison_locations"
	| "case_insensitive"
	| "class"
	| "ctorarg"
	| "ctorinit"
	| "debug"
	| "default"
	| "do" '=' name_or_string
	| "dotall"
	| "exception"
	| "extra_type"
	| "fast"
	| "find"
	| "flex"
	| "freespace"
	| "full"
	| "graphs_file"
	| "header_file"
	| "include"
	| "indent"
	| "input"
	| "interactive"
	| "lex"
	| "lex_compat"
	| "lexer"
	| "main"
	| "matcher" '=' name_or_string
	| "namespace"
	| "never_interactive"
	| "noarray"
	| "nocase_insensitive"
	| "nodebug"
	| "nodefault"
	| "nodotall"
	| "nofreespace"
	| "noindent"
	| "noinput"
	| "noline"
	| "nomain"
	| "nopointer"
	| "nostack"
	| "nostdinit"
	| "nounicode"
	| "nounistd"
	| "nounput"
	| "nowarn"
	| "noyylineno"
	| "noyymore"
	| "noyypanic"
	| "noyywrap"
	| "outfile" '=' name_or_string
	| "params"
	| "pattern"
	| "permissive"
	| "pointer"
	| "perf_report"
	| "posix_compat"
	| "prefix" '=' name_or_string
	| "reentrant"
	| "regexp_file"
	| "stack"
	| "stdinit"
	| "stdout"
	| "tables_file"
	| "tabs" '=' name_or_string
	| "token_eof"
	| "token_type"
	| "unicode"
	| "unicode" '=' unicode_block
	| "unput"
	| "verbose"
	| "warn"
	| "yy"
	| "yyclass"
	| "yylineno"
	| "yymore"
	| "yypanic"
	| "yywrap"
	| "YYLTYPE"
	| "YYSTYPE"
	| "7bit"
	| "8bit"

unicode_block::=
	  "\\p{IsBasicLatin}"
	| "\\p{IsLatin-1Supplement}"
	| "\\p{IsLatinExtended-A}"
	| "\\p{IsLatinExtended-B}"
	| "\\p{IsIPAExtensions}"
	| "\\p{IsSpacingModifierLetters}"
	| "\\p{IsCombiningDiacriticalMarks}"
	| "\\p{IsGreekandCoptic}"
	| "\\p{IsCyrillic}"
	| "\\p{IsCyrillicSupplement}"
	| "\\p{IsArmenian}"
	| "\\p{IsHebrew}"
	| "\\p{IsArabic}"
	| "\\p{IsSyriac}"
	| "\\p{IsArabicSupplement}"
	| "\\p{IsThaana}"
	| "\\p{IsNKo}"
	| "\\p{IsSamaritan}"
	| "\\p{IsMandaic}"
	| "\\p{IsSyriacSupplement}"
	| "\\p{IsArabicExtended-B}"
	| "\\p{IsArabicExtended-A}"
	| "\\p{IsDevanagari}"
	| "\\p{IsBengali}"
	| "\\p{IsGurmukhi}"
	| "\\p{IsGujarati}"
	| "\\p{IsOriya}"
	| "\\p{IsTamil}"
	| "\\p{IsTelugu}"
	| "\\p{IsKannada}"
	| "\\p{IsMalayalam}"
	| "\\p{IsSinhala}"
	| "\\p{IsThai}"
	| "\\p{IsLao}"
	| "\\p{IsTibetan}"
	| "\\p{IsMyanmar}"
	| "\\p{IsGeorgian}"
	| "\\p{IsHangulJamo}"
	| "\\p{IsEthiopic}"
	| "\\p{IsEthiopicSupplement}"
	| "\\p{IsCherokee}"
	| "\\p{IsUnifiedCanadianAboriginalSyllabics}"
	| "\\p{IsOgham}"
	| "\\p{IsRunic}"
	| "\\p{IsTagalog}"
	| "\\p{IsHanunoo}"
	| "\\p{IsBuhid}"
	| "\\p{IsTagbanwa}"
	| "\\p{IsKhmer}"
	| "\\p{IsMongolian}"
	| "\\p{IsUnifiedCanadianAboriginalSyllabicsExtended}"
	| "\\p{IsLimbu}"
	| "\\p{IsTaiLe}"
	| "\\p{IsNewTaiLue}"
	| "\\p{IsKhmerSymbols}"
	| "\\p{IsBuginese}"
	| "\\p{IsTaiTham}"
	| "\\p{IsCombiningDiacriticalMarksExtended}"
	| "\\p{IsBalinese}"
	| "\\p{IsSundanese}"
	| "\\p{IsBatak}"
	| "\\p{IsLepcha}"
	| "\\p{IsOlChiki}"
	| "\\p{IsCyrillicExtended-C}"
	| "\\p{IsGeorgianExtended}"
	| "\\p{IsSundaneseSupplement}"
	| "\\p{IsVedicExtensions}"
	| "\\p{IsPhoneticExtensions}"
	| "\\p{IsPhoneticExtensionsSupplement}"
	| "\\p{IsCombiningDiacriticalMarksSupplement}"
	| "\\p{IsLatinExtendedAdditional}"
	| "\\p{IsGreekExtended}"
	| "\\p{IsGeneralPunctuation}"
	| "\\p{IsSuperscriptsandSubscripts}"
	| "\\p{IsCurrencySymbols}"
	| "\\p{IsCombiningDiacriticalMarksforSymbols}"
	| "\\p{IsLetterlikeSymbols}"
	| "\\p{IsNumberForms}"
	| "\\p{IsArrows}"
	| "\\p{IsMathematicalOperators}"
	| "\\p{IsMiscellaneousTechnical}"
	| "\\p{IsControlPictures}"
	| "\\p{IsOpticalCharacterRecognition}"
	| "\\p{IsEnclosedAlphanumerics}"
	| "\\p{IsBoxDrawing}"
	| "\\p{IsBlockElements}"
	| "\\p{IsGeometricShapes}"
	| "\\p{IsMiscellaneousSymbols}"
	| "\\p{IsDingbats}"
	| "\\p{IsMiscellaneousMathematicalSymbols-A}"
	| "\\p{IsSupplementalArrows-A}"
	| "\\p{IsBraillePatterns}"
	| "\\p{IsSupplementalArrows-B}"
	| "\\p{IsMiscellaneousMathematicalSymbols-B}"
	| "\\p{IsSupplementalMathematicalOperators}"
	| "\\p{IsMiscellaneousSymbolsandArrows}"
	| "\\p{IsGlagolitic}"
	| "\\p{IsLatinExtended-C}"
	| "\\p{IsCoptic}"
	| "\\p{IsGeorgianSupplement}"
	| "\\p{IsTifinagh}"
	| "\\p{IsEthiopicExtended}"
	| "\\p{IsCyrillicExtended-A}"
	| "\\p{IsSupplementalPunctuation}"
	| "\\p{IsCJKRadicalsSupplement}"
	| "\\p{IsKangxiRadicals}"
	| "\\p{IsIdeographicDescriptionCharacters}"
	| "\\p{IsCJKSymbolsandPunctuation}"
	| "\\p{IsHiragana}"
	| "\\p{IsKatakana}"
	| "\\p{IsBopomofo}"
	| "\\p{IsHangulCompatibilityJamo}"
	| "\\p{IsKanbun}"
	| "\\p{IsBopomofoExtended}"
	| "\\p{IsCJKStrokes}"
	| "\\p{IsKatakanaPhoneticExtensions}"
	| "\\p{IsEnclosedCJKLettersandMonths}"
	| "\\p{IsCJKCompatibility}"
	| "\\p{IsCJKUnifiedIdeographsExtensionA}"
	| "\\p{IsYijingHexagramSymbols}"
	| "\\p{IsCJKUnifiedIdeographs}"
	| "\\p{IsYiSyllables}"
	| "\\p{IsYiRadicals}"
	| "\\p{IsLisu}"
	| "\\p{IsVai}"
	| "\\p{IsCyrillicExtended-B}"
	| "\\p{IsBamum}"
	| "\\p{IsModifierToneLetters}"
	| "\\p{IsLatinExtended-D}"
	| "\\p{IsSylotiNagri}"
	| "\\p{IsCommonIndicNumberForms}"
	| "\\p{IsPhags-pa}"
	| "\\p{IsSaurashtra}"
	| "\\p{IsDevanagariExtended}"
	| "\\p{IsKayahLi}"
	| "\\p{IsRejang}"
	| "\\p{IsHangulJamoExtended-A}"
	| "\\p{IsJavanese}"
	| "\\p{IsMyanmarExtended-B}"
	| "\\p{IsCham}"
	| "\\p{IsMyanmarExtended-A}"
	| "\\p{IsTaiViet}"
	| "\\p{IsMeeteiMayekExtensions}"
	| "\\p{IsEthiopicExtended-A}"
	| "\\p{IsLatinExtended-E}"
	| "\\p{IsCherokeeSupplement}"
	| "\\p{IsMeeteiMayek}"
	| "\\p{IsHangulSyllables}"
	| "\\p{IsHangulJamoExtended-B}"
	| "\\p{IsHighSurrogates}"
	| "\\p{IsHighPrivateUseSurrogates}"
	| "\\p{IsLowSurrogates}"
	| "\\p{IsPrivateUseArea}"
	| "\\p{IsCJKCompatibilityIdeographs}"
	| "\\p{IsAlphabeticPresentationForms}"
	| "\\p{IsArabicPresentationForms-A}"
	| "\\p{IsVariationSelectors}"
	| "\\p{IsVerticalForms}"
	| "\\p{IsCombiningHalfMarks}"
	| "\\p{IsCJKCompatibilityForms}"
	| "\\p{IsSmallFormVariants}"
	| "\\p{IsArabicPresentationForms-B}"
	| "\\p{IsHalfwidthandFullwidthForms}"
	| "\\p{IsSpecials}"
	| "\\p{IsLinearBSyllabary}"
	| "\\p{IsLinearBIdeograms}"
	| "\\p{IsAegeanNumbers}"
	| "\\p{IsAncientGreekNumbers}"
	| "\\p{IsAncientSymbols}"
	| "\\p{IsPhaistosDisc}"
	| "\\p{IsLycian}"
	| "\\p{IsCarian}"
	| "\\p{IsCopticEpactNumbers}"
	| "\\p{IsOldItalic}"
	| "\\p{IsGothic}"
	| "\\p{IsOldPermic}"
	| "\\p{IsUgaritic}"
	| "\\p{IsOldPersian}"
	| "\\p{IsDeseret}"
	| "\\p{IsShavian}"
	| "\\p{IsOsmanya}"
	| "\\p{IsOsage}"
	| "\\p{IsElbasan}"
	| "\\p{IsCaucasianAlbanian}"
	| "\\p{IsVithkuqi}"
	| "\\p{IsLinearA}"
	| "\\p{IsLatinExtended-F}"
	| "\\p{IsCypriotSyllabary}"
	| "\\p{IsImperialAramaic}"
	| "\\p{IsPalmyrene}"
	| "\\p{IsNabataean}"
	| "\\p{IsHatran}"
	| "\\p{IsPhoenician}"
	| "\\p{IsLydian}"
	| "\\p{IsMeroiticHieroglyphs}"
	| "\\p{IsMeroiticCursive}"
	| "\\p{IsKharoshthi}"
	| "\\p{IsOldSouthArabian}"
	| "\\p{IsOldNorthArabian}"
	| "\\p{IsManichaean}"
	| "\\p{IsAvestan}"
	| "\\p{IsInscriptionalParthian}"
	| "\\p{IsInscriptionalPahlavi}"
	| "\\p{IsPsalterPahlavi}"
	| "\\p{IsOldTurkic}"
	| "\\p{IsOldHungarian}"
	| "\\p{IsHanifiRohingya}"
	| "\\p{IsRumiNumeralSymbols}"
	| "\\p{IsYezidi}"
	| "\\p{IsOldSogdian}"
	| "\\p{IsSogdian}"
	| "\\p{IsOldUyghur}"
	| "\\p{IsChorasmian}"
	| "\\p{IsElymaic}"
	| "\\p{IsBrahmi}"
	| "\\p{IsKaithi}"
	| "\\p{IsSoraSompeng}"
	| "\\p{IsChakma}"
	| "\\p{IsMahajani}"
	| "\\p{IsSharada}"
	| "\\p{IsSinhalaArchaicNumbers}"
	| "\\p{IsKhojki}"
	| "\\p{IsMultani}"
	| "\\p{IsKhudawadi}"
	| "\\p{IsGrantha}"
	| "\\p{IsNewa}"
	| "\\p{IsTirhuta}"
	| "\\p{IsSiddham}"
	| "\\p{IsModi}"
	| "\\p{IsMongolianSupplement}"
	| "\\p{IsTakri}"
	| "\\p{IsAhom}"
	| "\\p{IsDogra}"
	| "\\p{IsWarangCiti}"
	| "\\p{IsDivesAkuru}"
	| "\\p{IsNandinagari}"
	| "\\p{IsZanabazarSquare}"
	| "\\p{IsSoyombo}"
	| "\\p{IsUnifiedCanadianAboriginalSyllabicsExtended-A}"
	| "\\p{IsPauCinHau}"
	| "\\p{IsBhaiksuki}"
	| "\\p{IsMarchen}"
	| "\\p{IsMasaramGondi}"
	| "\\p{IsGunjalaGondi}"
	| "\\p{IsMakasar}"
	| "\\p{IsLisuSupplement}"
	| "\\p{IsTamilSupplement}"
	| "\\p{IsCuneiform}"
	| "\\p{IsCuneiformNumbersandPunctuation}"
	| "\\p{IsEarlyDynasticCuneiform}"
	| "\\p{IsCypro-Minoan}"
	| "\\p{IsEgyptianHieroglyphs}"
	| "\\p{IsEgyptianHieroglyphFormatControls}"
	| "\\p{IsAnatolianHieroglyphs}"
	| "\\p{IsBamumSupplement}"
	| "\\p{IsMro}"
	| "\\p{IsTangsa}"
	| "\\p{IsBassaVah}"
	| "\\p{IsPahawhHmong}"
	| "\\p{IsMedefaidrin}"
	| "\\p{IsMiao}"
	| "\\p{IsIdeographicSymbolsandPunctuation}"
	| "\\p{IsTangut}"
	| "\\p{IsTangutComponents}"
	| "\\p{IsKhitanSmallScript}"
	| "\\p{IsTangutSupplement}"
	| "\\p{IsKanaExtended-B}"
	| "\\p{IsKanaSupplement}"
	| "\\p{IsKanaExtended-A}"
	| "\\p{IsSmallKanaExtension}"
	| "\\p{IsNushu}"
	| "\\p{IsDuployan}"
	| "\\p{IsShorthandFormatControls}"
	| "\\p{IsZnamennyMusicalNotation}"
	| "\\p{IsByzantineMusicalSymbols}"
	| "\\p{IsMusicalSymbols}"
	| "\\p{IsAncientGreekMusicalNotation}"
	| "\\p{IsMayanNumerals}"
	| "\\p{IsTaiXuanJingSymbols}"
	| "\\p{IsCountingRodNumerals}"
	| "\\p{IsMathematicalAlphanumericSymbols}"
	| "\\p{IsSuttonSignWriting}"
	| "\\p{IsLatinExtended-G}"
	| "\\p{IsGlagoliticSupplement}"
	| "\\p{IsNyiakengPuachueHmong}"
	| "\\p{IsToto}"
	| "\\p{IsWancho}"
	| "\\p{IsEthiopicExtended-B}"
	| "\\p{IsMendeKikakui}"
	| "\\p{IsAdlam}"
	| "\\p{IsIndicSiyaqNumbers}"
	| "\\p{IsOttomanSiyaqNumbers}"
	| "\\p{IsArabicMathematicalAlphabeticSymbols}"
	| "\\p{IsMahjongTiles}"
	| "\\p{IsDominoTiles}"
	| "\\p{IsPlayingCards}"
	| "\\p{IsEnclosedAlphanumericSupplement}"
	| "\\p{IsEnclosedIdeographicSupplement}"
	| "\\p{IsMiscellaneousSymbolsandPictographs}"
	| "\\p{IsEmoticons}"
	| "\\p{IsOrnamentalDingbats}"
	| "\\p{IsTransportandMapSymbols}"
	| "\\p{IsAlchemicalSymbols}"
	| "\\p{IsGeometricShapesExtended}"
	| "\\p{IsSupplementalArrows-C}"
	| "\\p{IsSupplementalSymbolsandPictographs}"
	| "\\p{IsChessSymbols}"
	| "\\p{IsSymbolsandPictographsExtended-A}"
	| "\\p{IsSymbolsforLegacyComputing}"
	| "\\p{IsCJKUnifiedIdeographsExtensionB}"
	| "\\p{IsCJKUnifiedIdeographsExtensionC}"
	| "\\p{IsCJKUnifiedIdeographsExtensionD}"
	| "\\p{IsCJKUnifiedIdeographsExtensionE}"
	| "\\p{IsCJKUnifiedIdeographsExtensionF}"
	| "\\p{IsCJKCompatibilityIdeographsSupplement}"
	| "\\p{IsCJKUnifiedIdeographsExtensionG}"
	| "\\p{IsTags}"
	| "\\p{IsVariationSelectorsSupplement}"
	| "\\p{IsSupplementaryPrivateUseArea-A}"
	| "\\p{IsSupplementaryPrivateUseArea-B}"
	| "\\p{Adlam}"
	| "\\p{Ahom}"
	| "\\p{Anatolian_Hieroglyphs}"
	| "\\p{Arabic}"
	| "\\p{Armenian}"
	| "\\p{Avestan}"
	| "\\p{Balinese}"
	| "\\p{Bamum}"
	| "\\p{Bassa_Vah}"
	| "\\p{Batak}"
	| "\\p{Bengali}"
	| "\\p{Bhaiksuki}"
	| "\\p{Bopomofo}"
	| "\\p{Brahmi}"
	| "\\p{Braille}"
	| "\\p{Buginese}"
	| "\\p{Buhid}"
	| "\\p{Canadian_Aboriginal}"
	| "\\p{Carian}"
	| "\\p{Caucasian_Albanian}"
	| "\\p{Chakma}"
	| "\\p{Cham}"
	| "\\p{Cherokee}"
	| "\\p{Chorasmian}"
	| "\\p{Common}"
	| "\\p{Coptic}"
	| "\\p{Cuneiform}"
	| "\\p{Cypriot}"
	| "\\p{Cypro_Minoan}"
	| "\\p{Cyrillic}"
	| "\\p{Deseret}"
	| "\\p{Devanagari}"
	| "\\p{Dives_Akuru}"
	| "\\p{Dogra}"
	| "\\p{Duployan}"
	| "\\p{Egyptian_Hieroglyphs}"
	| "\\p{Elbasan}"
	| "\\p{Elymaic}"
	| "\\p{Ethiopic}"
	| "\\p{Georgian}"
	| "\\p{Glagolitic}"
	| "\\p{Gothic}"
	| "\\p{Grantha}"
	| "\\p{Greek}"
	| "\\p{Gujarati}"
	| "\\p{Gunjala_Gondi}"
	| "\\p{Gurmukhi}"
	| "\\p{Han}"
	| "\\p{Hangul}"
	| "\\p{Hanifi_Rohingya}"
	| "\\p{Hanunoo}"
	| "\\p{Hatran}"
	| "\\p{Hebrew}"
	| "\\p{Hiragana}"
	| "\\p{Imperial_Aramaic}"
	| "\\p{Inscriptional_Pahlavi}"
	| "\\p{Inscriptional_Parthian}"
	| "\\p{Javanese}"
	| "\\p{Kaithi}"
	| "\\p{Kannada}"
	| "\\p{Katakana}"
	| "\\p{Kayah_Li}"
	| "\\p{Kharoshthi}"
	| "\\p{Khitan_Small_Script}"
	| "\\p{Khmer}"
	| "\\p{Khojki}"
	| "\\p{Khudawadi}"
	| "\\p{Lao}"
	| "\\p{Latin}"
	| "\\p{Lepcha}"
	| "\\p{Limbu}"
	| "\\p{Linear_A}"
	| "\\p{Linear_B}"
	| "\\p{Lisu}"
	| "\\p{Lycian}"
	| "\\p{Lydian}"
	| "\\p{Mahajani}"
	| "\\p{Makasar}"
	| "\\p{Malayalam}"
	| "\\p{Mandaic}"
	| "\\p{Manichaean}"
	| "\\p{Marchen}"
	| "\\p{Masaram_Gondi}"
	| "\\p{Medefaidrin}"
	| "\\p{Meetei_Mayek}"
	| "\\p{Mende_Kikakui}"
	| "\\p{Meroitic_Cursive}"
	| "\\p{Meroitic_Hieroglyphs}"
	| "\\p{Miao}"
	| "\\p{Modi}"
	| "\\p{Mongolian}"
	| "\\p{Mro}"
	| "\\p{Multani}"
	| "\\p{Myanmar}"
	| "\\p{Nabataean}"
	| "\\p{Nandinagari}"
	| "\\p{New_Tai_Lue}"
	| "\\p{Newa}"
	| "\\p{Nko}"
	| "\\p{Nushu}"
	| "\\p{Nyiakeng_Puachue_Hmong}"
	| "\\p{Ogham}"
	| "\\p{Old_Uyghur}"
	| "\\p{Ol_Chiki}"
	| "\\p{Old_Hungarian}"
	| "\\p{Old_Italic}"
	| "\\p{Old_North_Arabian}"
	| "\\p{Old_Permic}"
	| "\\p{Old_Persian}"
	| "\\p{Old_Sogdian}"
	| "\\p{Old_South_Arabian}"
	| "\\p{Old_Turkic}"
	| "\\p{Oriya}"
	| "\\p{Osage}"
	| "\\p{Osmanya}"
	| "\\p{Pahawh_Hmong}"
	| "\\p{Palmyrene}"
	| "\\p{Pau_Cin_Hau}"
	| "\\p{Phags_Pa}"
	| "\\p{Phoenician}"
	| "\\p{Psalter_Pahlavi}"
	| "\\p{Rejang}"
	| "\\p{Runic}"
	| "\\p{Samaritan}"
	| "\\p{Saurashtra}"
	| "\\p{Sharada}"
	| "\\p{Shavian}"
	| "\\p{Siddham}"
	| "\\p{SignWriting}"
	| "\\p{Sinhala}"
	| "\\p{Sogdian}"
	| "\\p{Sora_Sompeng}"
	| "\\p{Soyombo}"
	| "\\p{Sundanese}"
	| "\\p{Syloti_Nagri}"
	| "\\p{Syriac}"
	| "\\p{Tagalog}"
	| "\\p{Tagbanwa}"
	| "\\p{Tai_Le}"
	| "\\p{Tai_Tham}"
	| "\\p{Tai_Viet}"
	| "\\p{Takri}"
	| "\\p{Tamil}"
	| "\\p{Tangut}"
	| "\\p{Tangsa}"
	| "\\p{Telugu}"
	| "\\p{Thaana}"
	| "\\p{Thai}"
	| "\\p{Tibetan}"
	| "\\p{Tifinagh}"
	| "\\p{Tirhuta}"
	| "\\p{Toto}"
	| "\\p{Ugaritic}"
	| "\\p{Vai}"
	| "\\p{Vithkuqi}"
	| "\\p{Wancho}"
	| "\\p{Warang_Citi}"
	| "\\p{Yezidi}"
	| "\\p{Yi}"
	| "\\p{Zanabazar_Square}"

name_or_string::=
	  NAME
	| STRING

def_named_pattern::=
	  NAME pattern

pattern::=
	  patter_prefix pattern_part repetition patter_sufix
	| pattern patter_prefix pattern_part repetition patter_sufix
	| pattern '|' pattern

patter_prefix::=
	  /*%empty*/
	| "^"
	| "\\A"

patter_sufix::=
	  /*%empty*/
	| "$"
	| "\\z"

repetition::=
	  /*%empty*/
	| repetition_base
	| repetition_base '?'

repetition_base::=
	  '?'
	| '+'
	| '*'
	| '{' INTEGER ',' INTEGER '}'
	| '{' INTEGER ',' '}'
	| '{' INTEGER '}'

pattern_part::=
	  unicode_class
	| "\\d"
	| "\\s"
	| "\\a"
	| "\\b"
	| "\\t"
	| "\\v"
	| "\\f"
	| "\\r"
	| "\\n"
	| "\\."
	| "\\N"
	| "\\0"
	| "\\cX"
	| "\\[0-8]+"
	| "\\o[0-8]+"
	| "\\x[0-9A-Fa-f]+"
	| "\\u[0-9A-Fa-f]+"
	| "\Q...\E"
	| '.'
	| RECLASS
	| '{' NAME '}'
	| '(' pattern ')'
	| "(?:" pattern ')'
	| "(?=" pattern ')'
	| "(?<=" pattern ')'
	| "(?^" pattern ')'
	| "\\i"
	| "\\j"
	| "\\k"
	| "(?i:" pattern ')'
	| "(?m:" pattern ')'
	| "(?s:" pattern ')'
	| "(?u:" pattern ')'
	| "(?x:" pattern ')'
	| "(?#:" pattern ')'

unicode_class::=
	  "\\p{Space}"
	| "\\p{Unicode}"
	| "\\p{ASCII}"
	| "\\p{Non_ASCII_Unicode}"
	| "\\p{L&}"
	| "\\p{Letter}"
	| "\\p{L}"
	| "\\p{Mark}"
	| "\\p{M}"
	| "\\p{Separator}"
	| "\\p{Z}"
	| "\\p{Symbol}"
	| "\\p{S}"
	| "\\p{Number}"
	| "\\p{N}"
	| "\\p{Punctuation}"
	| "\\p{P}"
	| "\\p{Other}"
	| "\\p{C}"
	| "\\p{Lowercase_Letter}"
	| "\\p{Ll}"
	| "\\p{Uppercase_Letter}"
	| "\\p{Lu}"
	| "\\p{Titlecase_Letter}"
	| "\\p{Lt}"
	| "\\p{Modifier_Letter}"
	| "\\p{Lm}"
	| "\\p{Other_Letter}"
	| "\\p{Lo}"
	| "\\p{Non_Spacing_Mark}"
	| "\\p{Mn}"
	| "\\p{Spacing_Combining_Mark}"
	| "\\p{Mc}"
	| "\\p{Enclosing_Mark}"
	| "\\p{Me}"
	| "\\p{Space_Separator}"
	| "\\p{Zs}"
	| "\\p{Line_Separator}"
	| "\\p{Zl}"
	| "\\p{Paragraph_Separator}"
	| "\\p{Zp}"
	| "\\p{Math_Symbol}"
	| "\\p{Sm}"
	| "\\p{Currency_Symbol}"
	| "\\p{Sc}"
	| "\\p{Modifier_Symbol}"
	| "\\p{Sk}"
	| "\\p{Other_Symbol}"
	| "\\p{So}"
	| "\\p{Decimal_Digit_Number}"
	| "\\p{Nd}"
	| "\\p{Letter_Number}"
	| "\\p{Nl}"
	| "\\p{Other_Number}"
	| "\\p{No}"
	| "\\p{Dash_Punctuation}"
	| "\\p{Pd}"
	| "\\p{Open_Punctuation}"
	| "\\p{Ps}"
	| "\\p{Close_Punctuation}"
	| "\\p{Pe}"
	| "\\p{Initial_Punctuation}"
	| "\\p{Pi}"
	| "\\p{Final_Punctuation}"
	| "\\p{Pf}"
	| "\\p{Connector_Punctuation}"
	| "\\p{Pc}"
	| "\\p{Other_Punctuation}"
	| "\\p{Po}"
	| "\\p{Control}"
	| "\\p{Cc}"
	| "\\p{Format}"
	| "\\p{Cf}"
	| "\\p{UnicodeIdentifierStart}"
	| "\\p{UnicodeIdentifierPart}"
	| "\\p{IdentifierIgnorable}"
	| "\\p{JavaIdentifierStart}"
	| "\\p{JavaIdentifierPart}"
	| "\\p{CsIdentifierStart}"
	| "\\p{CsIdentifierPart}"
	| "\\p{PythonIdentifierStart}"
	| "\\p{PythonIdentifierPart}"

rules::=
	  rule
	| rules rule

rule::=
	  NL
	| pattern action

action::=
	  /*%empty*/
	| ACTION_CODE

//Tokens

NAME ::= [A-Za-z_][A-Za-z0-9_-]*
ACTION_CODE ::= '{' CODE_TILL_CURLY
USERCODE ::= .*
CODE_TILL_PCT_CURLY ::= [^%]* '%}'
CODE_TILL_CURLY ::= [^}]* '}'
RECLASS ::= '[' '^'?  [^\n\#x5D]+ ']'
STRING ::= '"' ("\\" . | [^"\n\\])+ '"'
INTEGER ::= [0-9]+

NL ::= '\n'

Whitespace ::= S | Comment
S ::= '\t' | '\r' | ' '
Comment ::= '/*' ( [^*] | '*'+ [^*/] )* '*'* '*/' | "//".*

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions