module.py
Go to the documentation of this file.
1 """
2 GTSAM Copyright 2010-2020, Georgia Tech Research Corporation,
3 Atlanta, Georgia 30332-0415
4 All Rights Reserved
5 
6 See LICENSE for the license information
7 
8 Rules and classes for parsing a module.
9 
10 Author: Duy Nguyen Ta, Fan Jiang, Matthew Sklar, Varun Agrawal, and Frank Dellaert
11 """
12 
13 # pylint: disable=unnecessary-lambda, unused-import, expression-not-assigned, no-else-return, protected-access, too-few-public-methods, too-many-arguments
14 
15 from pyparsing import (ParseResults, ZeroOrMore, # type: ignore
16  cppStyleComment, stringEnd)
17 
18 from .classes import Class
19 from .declaration import ForwardDeclaration, Include
20 from .enum import Enum
21 from .function import GlobalFunction
22 from .namespace import Namespace
23 from .template import TypedefTemplateInstantiation
24 from .variable import Variable
25 
26 
27 class Module:
28  """
29  Module is just a global namespace.
30 
31  E.g.
32  ```
33  namespace gtsam {
34  ...
35  }
36  ```
37  """
38 
39  rule = (
40  ZeroOrMore(ForwardDeclaration.rule #
41  ^ Include.rule #
42  ^ Class.rule #
43  ^ TypedefTemplateInstantiation.rule #
44  ^ GlobalFunction.rule #
45  ^ Enum.rule #
46  ^ Variable.rule #
47  ^ Namespace.rule #
48  ).setParseAction(lambda t: Namespace('', t.asList())) +
49  stringEnd)
50 
51  rule.ignore(cppStyleComment)
52 
53  @staticmethod
54  def parseString(s: str) -> ParseResults:
55  """Parse the source string and apply the rules."""
56  return Module.rule.parseString(s)[0]
gtwrap.interface_parser.namespace.Namespace
Definition: interface_parser/namespace.py:58
gtwrap.interface_parser.module.parseString
ParseResults parseString(str s)
Definition: module.py:54


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:03:11