2 GTSAM Copyright 2010-2020, Georgia Tech Research Corporation,
3 Atlanta, Georgia 30332-0415
6 See LICENSE for the license information
8 Parser class and rules for parsing C++ enums.
13 from pyparsing
import delimitedList
15 from .tokens
import ENUM, IDENT, LBRACE, RBRACE, SEMI_COLON
16 from .type
import Typename
17 from .utils
import collect_namespaces
22 Rule to parse an enumerator inside an enum.
36 Rule to parse enums defined in the interface file.
47 rule = (ENUM +
IDENT(
"name") + LBRACE +
48 delimitedList(Enumerator.rule)(
"enumerators") + RBRACE +
49 SEMI_COLON).setParseAction(
lambda t:
Enum(t.name, t.enumerators))
51 def __init__(self, name, enumerators, parent=''):
57 """Get the namespaces which this class is nested under as a list."""
62 Return a Typename with the namespaces and cpp name of this
66 namespaces_name.append(self.
name)