Skip to content

Provide way to determine various parts of a rule #153

@mahonnaise

Description

@mahonnaise

This [1] is weird. I assumed each rule was self-contained piece and not a self-contained piece within a closure (which was generated by the build process).

If you are trying to write a new rule, you might feel inclined to skip the whole building process (because it's kinda annoying) and just include the new rule on your test page. However, your new rule won't be inside that closure anymore and parserlib will be undefined (-> "Fatal error, cannot continue: parserlib is not defined").

There are at least two options:

  1. Pass parserlib as third argument to a rule's init function.
  2. Introduce a different way to identify pieces which doesn't rely on instanceof.

Either way, I'd get the rules out of that closure. They shouldn't have access to it.

Edit: [1] Original title was "Rules gain access to parserlib via closure"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions