toml_foolery.decode.peg_grammar

This module was automatically generated from the following grammar:

#; This document describes TOML's syntax, using the ABNF format (defined in #; RFC 5234 -- https://www.ietf.org/rfc/rfc5234.txt). #; #; All valid TOML documents will match this description, however certain #; invalid documents would need to be rejected as per the semantics described #; in the supporting text description.

#; It is possible to try this grammar interactively, using instaparse. #; http://instaparse.mojombo.com/ #; #; To do so, in the lower right, click on Options and change :input-format to #; ':abnf'. Then paste this entire ABNF document into the grammar entry box #; (above the options). Then you can type or paste a sample TOML document into #; the beige box on the left. Tada!

#; Overall Structure

More...

Public Imports

pegged.peg
public import pegged.peg;

Members

Aliases

TomlGrammar
alias TomlGrammar = GenericTomlGrammar!(ParseTree).TomlGrammar
Undocumented in source.

Structs

GenericTomlGrammar
struct GenericTomlGrammar(TParseTree)
Undocumented in source.

Detailed Description

TomlGrammar:

toml <- expression ( newline expression )* :eoi

expression <- ws table ws ( comment )? / ws keyval ws ( comment )? / ws ( comment )?

#; Whitespace

ws <- wschar* wschar <- [ ] / [\t] # Space / Horizontal tab

#; Newline

newline <: [\n] / [\r] [\n] # LF / CRLF

#; Comment

comment_start_symbol <- # # non_ascii <- [\x80-\uD7FF] / [\uE000-\U0010FFFF] non_eol <- [\t] / [ -~] / non_ascii

comment <- comment_start_symbol non_eol*

#; Key-Value pairs

keyval <- key keyval_sep val

key <- dotted_key / simple_key simple_key <- quoted_key / unquoted_key

unquoted_key <- ( ALPHA / DIGIT / [-] / _ )+ # A-Z / a-z / 0-9 / - / _ quoted_key <- basic_string / literal_string dotted_key <- simple_key ( dot_sep simple_key )+

dot_sep <- ws . ws # . Period keyval_sep <- ws [=] ws # =

val <- string_ / boolean / array / inline_table / date_time / float_ / integer

#; String

string_ <- ml_basic_string / basic_string / ml_literal_string / literal_string

#; Basic String

basic_string <- quotation_mark basic_char* quotation_mark

quotation_mark <- ["] # "

basic_char <- basic_unescaped / escaped basic_unescaped <- wschar / [!] / \[] / [\] ~ / non_ascii escaped <- escape escape_seq_char

escape <- [\\] # \

# %x22 " quotation mark U+0022 # %x5C \ reverse solidus U+005C # %x62 b backspace U+0008 # %x66 f form feed U+000C # %x6E n line feed U+000A # %x72 r carriage return U+000D # %x74 t tab U+0009 # %x75 4HEXDIG uXXXX U+XXXX # %x55 8HEXDIG UXXXXXXXX U+XXXXXXXX escape_seq_char <- ["] / [\\] / b / f / n / r / t / u HEXDIG HEXDIG HEXDIG HEXDIG / U HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG

#; Multiline Basic String

ml_basic_string <- ml_basic_string_delim ( newline )? ml_basic_body ml_basic_string_delim ml_basic_string_delim <- quotation_mark quotation_mark quotation_mark ml_basic_body <- mlb_content* ( mlb_quotes mlb_content+ )* ( mlb_quotes )?

mlb_content <- mlb_char / newline / mlb_escaped_nl mlb_char <- mlb_unescaped / escaped mlb_quotes <- quotation_mark quotation_mark? !quotation_mark mlb_unescaped <- wschar / [!] / \[] / [\] ~ / non_ascii mlb_escaped_nl <- escape ws newline ( wschar / newline )*

#; Literal String

literal_string <- apostrophe literal_char* apostrophe

apostrophe <- ['] # ' apostrophe

literal_char <- [\t] / [ -&] / [(-~] / non_ascii

#; Multiline Literal String

ml_literal_string <- ml_literal_string_delim ( newline )? ml_literal_body ml_literal_string_delim ml_literal_string_delim <- apostrophe apostrophe apostrophe ml_literal_body <- mll_content* ( mll_quotes mll_content+ )* ( mll_quotes )?

mll_content <- mll_char / newline mll_char <- [\t] / [ -&] / [(-~] / non_ascii mll_quotes <- apostrophe apostrophe? !apostrophe

#; Integer

integer <- hex_int / oct_int / bin_int / dec_int

minus <- [-] # - plus <- [+] # + underscore <- _ # _ digit1_9 <- [1-9] # 1-9 digit0_7 <- [0-7] # 0-7 digit0_1 <- [0-1] # 0-1

hex_prefix <- "0x" # 0x oct_prefix <- "0o" # 0o bin_prefix <- "0b" # 0b

dec_int <- ( minus / plus )? unsigned_dec_int unsigned_dec_int <- digit1_9 ( DIGIT / underscore DIGIT )+ / DIGIT

hex_int <- hex_prefix HEXDIG ( HEXDIG / underscore HEXDIG )* oct_int <- oct_prefix digit0_7 ( digit0_7 / underscore digit0_7 )* bin_int <- bin_prefix digit0_1 ( digit0_1 / underscore digit0_1 )*

#; Float

float_ <- float_int_part ( exp / frac ( exp )? ) / special_float

float_int_part <- dec_int frac <- decimal_point zero_prefixable_int decimal_point <- . # . zero_prefixable_int <- DIGIT ( DIGIT / underscore DIGIT )*

exp <- "e" float_exp_part float_exp_part <- ( minus / plus )? zero_prefixable_int

special_float <- ( minus / plus )? ( inf / nan ) inf <- "inf" # inf nan <- "nan" # nan

#; Boolean

boolean <- true_ / false_

true_ <- "true" # true false_ <- "false" # false

#; Date and Time (as defined in RFC 3339)

date_time <- offset_date_time / local_date_time / local_date / local_time

date_fullyear <- DIGIT DIGIT DIGIT DIGIT date_month <- DIGIT DIGIT # 01-12 date_mday <- DIGIT DIGIT # 01-28, 01-29, 01-30, 01-31 based on month/year time_delim <- "T" / [ ] # T, t, or space time_hour <- DIGIT DIGIT # 00-23 time_minute <- DIGIT DIGIT # 00-59 time_second <- DIGIT DIGIT # 00-58, 00-59, 00-60 based on leap second rules time_secfrac <- "." DIGIT+ time_numoffset <- ( "+" / "-" ) time_hour ":" time_minute time_offset <- "Z" / time_numoffset

partial_time <- time_hour ":" time_minute ":" time_second ( time_secfrac )? full_date <- date_fullyear "-" date_month "-" date_mday full_time <- partial_time time_offset

#; Offset Date-Time

offset_date_time <- full_date time_delim full_time

#; Local Date-Time

local_date_time <- full_date time_delim partial_time

#; Local Date

local_date <- full_date

#; Local Time

local_time <- partial_time

#; Array

array <- array_open ( array_values )? ws_comment_newline array_close

array_open <- [\[] # [ array_close <- [\]] # ]

array_values <- ws_comment_newline val ws_comment_newline array_sep array_values / ws_comment_newline val ws_comment_newline ( array_sep )?

array_sep <- [,] # , Comma

ws_comment_newline <- ( wschar / ( comment )? newline )*

#; Table

table <- std_table / array_table

#; Standard Table

std_table <- std_table_open key std_table_close

std_table_open <- [\[] ws # [ Left square bracket std_table_close <- ws [\]] # ] Right square bracket

#; Inline Table

inline_table <- inline_table_open ( inline_table_keyvals )? inline_table_close

inline_table_open <- [{] ws # { inline_table_close <- ws [}] # } inline_table_sep <- ws [,] ws # , Comma

inline_table_keyvals <- keyval ( inline_table_sep inline_table_keyvals )?

#; Array Table

array_table <- array_table_open key array_table_close

array_table_open <- "[[" ws # [[ Double left square bracket array_table_close <- ws "]]" # ]] Double right square bracket

#; Built-in ABNF terms, reproduced here for clarity

ALPHA <- [A-Z] / [a-z] # A-Z / a-z DIGIT <- [0-9] # 0-9 HEXDIG <- DIGIT / [A-Fa-f]

Meta