importpypeg2asppclassInstruction(str):passclassBlock(pp.List):grammar="{",pp.maybe_some(Instruction),"}"def__repr__(self):return" ".join(self)b=pp.parse(r"{ hello world }",Block)print(b)
prints "hello world"
Does not work, raises SyntaxError
importpypeg2asppclassInstruction(str):passclassBlock(pp.List):grammar="{",pp.maybe_some(Instruction),"}"def__repr__(self):return" ".join(self)b=pp.parse(r"{ $hello world }",Block)print(b)
The only difference being the dollar in "$hello world"
It appears all symbol characters are not considered str
Consider example 2.2.3 from the docs https://fdik.org/pyPEG2/grammar_elements.html#list
Works
```Python
import pypeg2 as pp
class Instruction(str): pass
class Block(pp.List):
grammar = "{", pp.maybe_some(Instruction), "}"
def __repr__(self):
return " ".join(self)
b = pp.parse(r"{ hello world }", Block)
print(b)
```
prints "hello world"
Does not work, raises SyntaxError
```Python
import pypeg2 as pp
class Instruction(str): pass
class Block(pp.List):
grammar = "{", pp.maybe_some(Instruction), "}"
def __repr__(self):
return " ".join(self)
b = pp.parse(r"{ $hello world }", Block)
print(b)
```
The only difference being the dollar in "$hello world"
It appears all symbol characters are not considered str
Ahh the definition of word is regex \w which disallows any non (0-9|A-Z|a-z) it needs to be more like ([`#$])?([\w.])+
Which would allow tick, hash or dollar to preceed words and class.member to be possible.
This should be mentioned in the online docs.
Ahh the definition of word is regex \w which disallows any non (0-9|A-Z|a-z) it needs to be more like ([`#$])?([\w\.])+
Which would allow tick, hash or dollar to preceed words and class.member to be possible.
This should be mentioned in the online docs.
Consider example 2.2.3 from the docs https://fdik.org/pyPEG2/grammar_elements.html#list
Works
prints "hello world"
Does not work, raises SyntaxError
The only difference being the dollar in "$hello world"
It appears all symbol characters are not considered str
Ahh the definition of word is regex \w which disallows any non (0-9|A-Z|a-z) it needs to be more like ([`#$])?([\w.])+
Which would allow tick, hash or dollar to preceed words and class.member to be possible.
This should be mentioned in the online docs.