Skip to content

Instantly share code, notes, and snippets.

@QuantumFractal
Created November 17, 2019 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QuantumFractal/22ef6321b3af94eaa7f2d7be011261e3 to your computer and use it in GitHub Desktop.
Save QuantumFractal/22ef6321b3af94eaa7f2d7be011261e3 to your computer and use it in GitHub Desktop.
svg_grammar = '''
start : prolog element
prolog: "<?xml" S? attr+ "?>" WS?
element: inline_tag | start_tag element end_tag
start_tag : S? "<" name S? attr+ ">" WS+
end_tag : S? "</" name S? ">" WS+
inline_tag : S? "<" name S? attr+ "/>" WS+
letter : "a".."z" | "A".."Z" | "0".."9" | "-"
name : STRING
attr : name "=" attr_val S?
attr_val : ESCAPED_STRING
STRING : /[a-zA-Z0-9-_]+/
S : WS_INLINE
%import common.WS_INLINE
%import common.ESCAPED_STRING
%import common.WS
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment