pylint-bot / pylint-unofficial

UNOFFICIAL playground for pylint github migration
0 stars 0 forks source link

Various no-member errors with pypeg2 #492

Open pylint-bot opened 9 years ago

pylint-bot commented 9 years ago

Originally reported by: Florian Bruhin (BitBucket: The-Compiler, GitHub: @The-Compiler?)


Last one, I promise! (After this I reported every issue where I had a workaround for)

With this code (slightly adjusted example from the docs) using pyPEG2:

#!python
from pypeg2 import Keyword, K, Enum, attr, optional, csl, maybe_some, name, Namespace, word, List, parse

class Type(Keyword):
    grammar = Enum( K("int"), K("long") )

class Parameter:
    grammar = attr("typing", Type), name()

class Parameters(Namespace):
    grammar = optional(csl(Parameter))

class Instruction(str):
    grammar = word, ";"

block = "{", maybe_some(Instruction), "}"
class Function(List):
    grammar = attr("typing", Type), name(), \
            "(", attr("parms", Parameters), ")", block

f = parse("int f(int a, long b) { do_this; do_that; }",
        Function)
print(f.name)
print(f.typing)
print(f.parms["b"].typing)
print(f[0])
print(f[1])

I get the following no-member errors:

E: 22, 6: Instance of 'list' has no 'name' member (no-member)
E: 22, 6: Instance of 'List' has no 'name' member (no-member)
E: 22, 6: Instance of 'SyntaxError' has no 'name' member (no-member)
E: 23, 6: Instance of 'list' has no 'typing' member (no-member)
E: 23, 6: Instance of 'List' has no 'typing' member (no-member)
E: 23, 6: Instance of 'SyntaxError' has no 'typing' member (no-member)
E: 24, 6: Instance of 'SyntaxError' has no 'parms' member (no-member)
E: 24, 6: Instance of 'list' has no 'parms' member (no-member)
E: 24, 6: Instance of 'List' has no 'parms' member (no-member)

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


;-) Damn, and I wanted to go below 150 issues. Thanks.