Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amplify the recommendation to use resource files whenever escaping #148

Open
matanox opened this issue Oct 29, 2016 · 0 comments
Open

Amplify the recommendation to use resource files whenever escaping #148

matanox opened this issue Oct 29, 2016 · 0 comments

Comments

@matanox
Copy link

matanox commented Oct 29, 2016

This is an excellent implementation with great documentation.
One thing I think, is that building rules inside a clojure source file can be a nice gameful challenge, yet tedious, and more importantly unreadable during later maintenance ― whenever there is the need to escape characters. E.g. consider this definition below, even the comment inside it requires escaping, not just the quote signs and back-slashes. It might be good to slightly more explicitly recommend, in the readme, as a rule of thumb, switching to resource files as early as the need to escape anything arise.

(def wikiextractor-parser
      "a parser for the output of wikiextractor (https://github.com/attardi/wikiextractor)"
      (parser
        "
          S = Entry*
          Entry = <Header> ContentAsText <Trailer> <OptionalPadding*>
          Header = '<doc' (' ' HeaderProp)* '>'
          HeaderProp = #'[^=]*' '=' '\"' #'[^\"]*' '\"' (* e.g. id=\"4030\" *)
          ContentAsText = Anychar*
          Anychar = #'(?sm).'
          Trailer = '</doc>'
          OptionalPadding = #'\\s'
      ")
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant