#NEWLINE# def svg_grammar( ) : #NEWLINE# #INDENT# '\n    Returns the grammar used to parse SVG paths\n    ' #NEWLINE# comma = PYP . Literal ( ',' ) . suppress ( ) #NEWLINE# dot = PYP . Literal ( '.' ) #NEWLINE# space = PYP . Literal ( ' ' ) #NEWLINE# coord = PYP . Regex ( '-?\\d+(\\.\\d*)?([Ee][+-]?\\d+)?' ) #NEWLINE# one_coord = PYP . Group ( coord ) #NEWLINE# xycoords = PYP . Group ( ( ( coord + PYP . Optional ( comma ) ) + coord ) ) #NEWLINE# two_xycoords = ( ( xycoords + PYP . Optional ( comma ) ) + xycoords ) #NEWLINE# three_xycoords = ( ( ( ( xycoords + PYP . Optional ( comma ) ) + xycoords ) + PYP . Optional ( comma ) ) + xycoords ) #NEWLINE# c_M = ( PYP . Literal ( 'M' ) + PYP . OneOrMore ( xycoords ) ) #NEWLINE# c_m = ( PYP . Literal ( 'm' ) + PYP . OneOrMore ( xycoords ) ) #NEWLINE# c_C = ( PYP . Literal ( 'C' ) + PYP . OneOrMore ( three_xycoords ) ) #NEWLINE# c_c = ( PYP . Literal ( 'c' ) + PYP . OneOrMore ( three_xycoords ) ) #NEWLINE# c_Q = ( PYP . Literal ( 'Q' ) + PYP . OneOrMore ( two_xycoords ) ) #NEWLINE# c_q = ( PYP . Literal ( 'q' ) + PYP . OneOrMore ( two_xycoords ) ) #NEWLINE# c_T = ( PYP . Literal ( 'T' ) + PYP . OneOrMore ( xycoords ) ) #NEWLINE# c_t = ( PYP . Literal ( 't' ) + PYP . OneOrMore ( c_V ) ) #NEWLINE# c_L = ( PYP . Literal ( 'L' ) + PYP . OneOrMore ( xycoords ) ) #NEWLINE# c_l = ( PYP . Literal ( 'l' ) + PYP . OneOrMore ( xycoords ) ) #NEWLINE# c_V = ( PYP . Literal ( 'V' ) + PYP . OneOrMore ( one_coord ) ) #NEWLINE# c_v = ( PYP . Literal ( 'v' ) + PYP . OneOrMore ( one_coord ) ) #NEWLINE# c_H = ( PYP . Literal ( 'H' ) + PYP . OneOrMore ( one_coord ) ) #NEWLINE# c_h = ( PYP . Literal ( 'h' ) + PYP . OneOrMore ( one_coord ) ) #NEWLINE# c_S = ( PYP . Literal ( 'S' ) + PYP . OneOrMore ( two_xycoords ) ) #NEWLINE# c_s = ( PYP . Literal ( 's' ) + PYP . OneOrMore ( two_xycoords ) ) #NEWLINE# c_z = PYP . Literal ( 'z' ) #NEWLINE# c_Z = PYP . Literal ( 'Z' ) #NEWLINE# path_cmd = ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( c_M | c_m ) | c_C ) | c_c ) | c_Q ) | c_q ) | c_T ) | c_t ) | c_L ) | c_l ) | c_V ) | c_v ) | c_H ) | c_h ) | c_S ) | c_s ) | c_Z ) | c_z ) #NEWLINE# return PYP . OneOrMore ( PYP . Group ( path_cmd ) )