dignifiedquire / dignifiedquire/pegjs-coffee-plugin
Accessing variables/functions from initializer in predicates doesn't work
- Dominant language
- JavaScript
- Stars
- 34
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
This is my initializer in the .pegcoffee file
```
{
@knownNamespaces = []
@isKnownNamespace = (ns) ->
for x in namespaces
if ns in x
return true
return false
}
```
When I try to use the definitions
```
Element
= tagInfos:StartTag
& {
@knownNamespaces.push(tagInfos.namespaces)
prefix = tagInfos.qid.prefix
if (@isKnownNamespace(prefix) == false)
error("unknown namespace prefix '" + prefix + "'")
true
}
ElementContent*
& {
@knownNamespaces.pop()
}
qid:EndTag
{ if ( tagInfos.qid.full != qid.full ) then expected "that start and end tag must be identical" }
```
In the final action I can access, e.g. @knownNamespaces, but not in the predicates!?!
Any help?
thanks,
Jan
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.