configGrammar

PEG grammar for libconfig

enum configGrammar = r" # Comments and include directive are not part of this grammar. # They must be handled before the input is given to the PEG parser Config: Document < eoi / Setting+ Setting < Name (':' / '=') Value (';' / ',')? Value <- Scalar / Array / List / Group Scalar <- Bool / Float / Integer / String # Float MUST be before Integer Array < '[' ( Scalar (',' Scalar)* )? ']' List < '(' ( Value (',' Value)* )? ')' Group < '{' Setting* '}' Name <~ [A-Za-z] ( [-A-Za-z0-9_] )* Bool <~ [Tt] [Rr] [Uu] [Ee] / [Ff] [Aa] [Ll] [Ss] [Ee] Integer <- (Hex / Dec) ('LL' / 'L')? Hex <~ :'0' :[Xx] hexDigit+ Dec <~ [-+]? digits Float <~ ( [-+]? digit* ^'.' digit* ( [eE] [-+]? digits )? ) / ( [-+]? digit+ (^'.' digit*)? [eE] [-+]? digits ) StringQuot <~ :doublequote ( backslash backslash / backslash doublequote / backslash ^'f' / backslash ^'n' / backslash ^'r' / backslash ^'t' / !doublequote !backslash . )* :doublequote String <~ (StringQuot spacing?)+ ";

Meta