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

Use of "struct" keyword when declaring variables of a typedef'd struct with argument type fails #28

Closed
d0c-s4vage opened this issue Oct 21, 2019 · 0 comments · Fixed by #29

Comments

@d0c-s4vage
Copy link
Owner

d0c-s4vage commented Oct 21, 2019

Example:

typedef struct(int variable)
{
    unsigned short a;
    unsigned short b;
} RESOURCE_DIRECTORY_TABLE;

struct RESOURCE_DIRECTORY_TABLE test(1);

Yields:

Traceback (most recent call last):                                                                                                                                                                                                  
  File "/home/james/__ws__/dev/pfp/tests/test_struct_union.py", line 111, in test_struct_with_parameters4                                                                                                                           
    """,                                                                                                                                                                                                                            
  File "/home/james/__ws__/dev/pfp/tests/utils.py", line 53, in _test_parse_build_with_string
    return self._test_parse_build_orig(*args, **kwargs)
  File "/home/james/__ws__/dev/pfp/tests/utils.py", line 73, in _test_parse_build
    data, template, debug=debug, predefines=predefines, printf=printf
  File "/home/james/__ws__/dev/pfp/tests/../pfp/__init__.py", line 91, in parse
    printf=printf,
  File "/home/james/__ws__/dev/pfp/tests/../pfp/interp.py", line 733, in parse
    self._ast = self._parse_string(template, predefines)
  File "/home/james/__ws__/dev/pfp/tests/../pfp/interp.py", line 878, in _parse_string
    keep_scopes=predefines,
  File "/home/james/__ws__/dev/pfp/venv3/lib/python3.6/site-packages/py010parser/__init__.py", line 137, in parse_string                                                                                                           
    keep_scopes     = keep_scopes
  File "/home/james/__ws__/dev/pfp/venv3/lib/python3.6/site-packages/py010parser/c_parser.py", line 178, in parse
    debug=debuglevel)
  File "/home/james/__ws__/dev/pfp/venv3/lib/python3.6/site-packages/py010parser/ply/yacc.py", line 265, in parse
    return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
  File "/home/james/__ws__/dev/pfp/venv3/lib/python3.6/site-packages/py010parser/ply/yacc.py", line 1047, in parseopt_notrack                                                                                                      
    tok = self.errorfunc(errtoken)
  File "/home/james/__ws__/dev/pfp/venv3/lib/python3.6/site-packages/py010parser/c_parser.py", line 1952, in p_error                                                                                                               
    column=self.clex.find_tok_column(p)))
  File "/home/james/__ws__/dev/pfp/venv3/lib/python3.6/site-packages/py010parser/plyparser.py", line 54, in _parse_error                                                                                                           
    raise ParseError("%s: %s" % (coord, msg))
py010parser.plyparser.ParseError: /tmp/tmp9xmb09le:8:38: before: 1
@d0c-s4vage d0c-s4vage changed the title Local Use of "struct" keyword when declaring variables of a typedef'd struct with argument type fails Oct 21, 2019
d0c-s4vage added a commit that referenced this issue Oct 23, 2019
…efd_struct

Fixes #28 - Can now use parameterized structs with the struct keyword
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

Successfully merging a pull request may close this issue.

1 participant